Read World Cooordinate System parameters from a .wcs
file, such as those written by SAOImageDS9.
pip install git+https://github.com/will-henney/wcsfile.git
It needs to be installed from github since it has not been submitted to PyPI yet.
Use wcsfile.read()
to read a WCS file into a python dict.
import wcsfile
wcsdict = wcsfile.read("testdata/mosaic-1996-HH204-align-robberto.wcs")
wcsdict
The dict can be used to initialize a FITS header object.
from astropy.io import fits
hdr = fits.Header(wcsdict)
hdr
Or it can be used to initialize a WCS object.
from astropy.wcs import WCS
w = WCS(wcsdict)
w
assert w.wcs.lattyp == "DEC"