This file contains hidden or 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
def mnras_coords(ra, dec): | |
'''Convert coordinates to MNRAS LaTeX friendly strings. | |
ra, dec must be in the format hh:mm:ss.s, dd:mm:ss, and will only return | |
the precision shown there. | |
''' | |
ra_hms, dec_dms = ra, dec | |
if '+' in dec_dms: |
This file contains hidden or 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
def hms_dms_dd(ra, dec, delimiter=" "): | |
"""Convert from HMS; DMS to DD. | |
Examples: | |
>>> ra, dec = hms_dms_dd("00h59m59.3s", "-00d00m01.01s") | |
>>> ra, dec | |
(14.997083333333332, -0.00028055555555555554) | |
>>> ra, dec = hms_dms_dd("23 59 59", "+56 00 00") | |
>>> ra, dec | |
(359.99583333333334, 56.0) |
This file contains hidden or 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 | |
from astropy.io import fits | |
def strip_naxis(fitsimage, outname=None, strip_wcs=True): | |
"""Strip additional axes from FITS file. | |
Strips axes 3 and/or 4 if present. | |
Parameters |
This file contains hidden or 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
# ---------------------------------------------------------------------------- # | |
# | |
# Perform radial basis function interpolation on a sparse grid provided a | |
# reference array/image is available. | |
# Alternatively, perform nearest neighbout interpolation. | |
# Generalisation of code present in https://github.com/nhurleywalker/fits_warp | |
# | |
# ---------------------------------------------------------------------------- # | |
from __future__ import print_function, division |
This file contains hidden or 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
#! /usr/bin/env python | |
from __future__ import print_function, division | |
import numpy as np | |
from argparse import ArgumentParser | |
from astropy.io.votable import parse_single_table | |
def open_xml(xml): |
This file contains hidden or 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
#! /usr/bin/env python | |
from __future__ import print_function, division | |
import os | |
import shutil | |
from subprocess import Popen | |
from argparse import ArgumentParser | |
from astropy.io import fits |
This file contains hidden or 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
# TODO: | |
# Add precision options. Currently values are returned at arbitrary precision. | |
# Add `strip_extra_axes` function for use when reading in FITS images. | |
# Clean up read_fits and associated FITS file handling functions. | |
# Fix up documentation. | |
# This code is years worth of additions and changes that represent my own 'journey' in learning python | |
# and studying radio astronomy - so some (a lot) of it is horribly ineffecient. | |
import numpy as np |
This file contains hidden or 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
#! /usr/bin/env python | |
from argparse import ArgumentParser | |
import numpy as np | |
from scipy.optimize import curve_fit | |
from matplotlib import pyplot as plt | |
def powerlaw(x, a, b): | |
return a*(x**b) | |
def powerlaw_amplitude(x0, y0, b): |
This file contains hidden or 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
#! /usr/bin/env python | |
from __future__ import print_function, division | |
import numpy as np | |
import sys | |
from astropy.constants import c; c = c.value | |
import matplotlib as mpl |
This file contains hidden or 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
#! /usr/bin/env python | |
from astropy.io import fits | |
import numpy as np | |
from argparse import ArgumentParser | |
def clip(image, clip_image, clip_level, outname, | |
fill_value=0): | |
""" | |
""" |
OlderNewer