Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from astropy import wcs | |
import numpy as np | |
def ang_to_pipi(a): | |
""" Convert any angle to the range ]-pi, pi] | |
Parameters | |
========== | |
a : float or astropy.units.Quantity | |
Angle to convert. If it has no quantity, assumes it is in radians. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
qstat -a 1>&2 | grep -oP "^(\d+)(?=\.)" | xargs -n 1 showstart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include "%L" | |
<mu> <a> : "α" Greek_alpha | |
<mu> <A> : "Α" Greek_ALPHA | |
<mu> <b> : "β" Greek_beta | |
<mu> <B> : "Β" Greek_BETA | |
<mu> <g> : "γ" Greek_gamma | |
<mu> <G> : "Γ" Greek_GAMMA | |
<mu> <d> : "δ" Greek_delta | |
<mu> <D> : "Δ" Greek_DELTA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import IPython | |
def _num_formatter(num): | |
return "{:_}".format(num) | |
def _ipython_formatter(arg, p, cycle): | |
p.text(_num_formatter(arg)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Smart bookmarklet for NASA ADS (https://ui.adsabs.harvard.edu) | |
Author: G. Pelouze | |
# Installation (Works with Firefox, probably elsewhere too) | |
- Create a new bookmark | |
- paste the minified js (last line of this snippet) in the 'location' field | |
- type 'ads' in the 'keyword' field (or any other keyword) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import difflib | |
def fits_headers_diff(h1, h2, print_diff=False): | |
''' Determine the difference between two FITS headers | |
Parameters | |
========== | |
h1, h2 : astropy.io.fits.header.Header | |
The two FITS headers to compare | |
print_diff : bool (default: False) | |
If True, print the diff in addition to returning it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def aggressive_autoscale(axes, axis, margin=0.1): | |
''' Autoscale an axis taking into account the limit along the other axis. | |
Example use case: set the x-limits, then autoscale the y-axis using only | |
the y-data within the x-limits. (Matplotlib's behaviour would be to use the | |
full y-data.) | |
Parameters |