Hi everyone,
I’m trying to use the WCS module within Astropy to do some simple object location work on Extended Source image cubes from the 2MASS survey, downloaded from IRSA. I keep running into an error that I can’t seem to understand or overcome, which seems to relate to the interaction with the external wcslib C library. FYI, I’m using Astropy 1.1.2 on Python 3.4.4 through iPython 3.2.0.
I’ve attached an example image (2.2 MB) for your reference, which I use for the code snippets below. The data in the primary extension of the fits file is 3-dimensional (a cube), which is a stack of images in various bands. This is the way that these Extended Source cubes are distributed by IRSA.
I can use Astropy io.fits utilities to open the fits file and read in the header.
---------
from
astropy.io import fits
hdulist = fits.open('2MASXJ22091625-4709599.fits’)
header = hdulist[0].header # astropy header instance
---------
Then I can use the astropy.wcs.WCS constructor to extract the WCS from this header
---------
from astropy import was
astr = wcs.WCS(header)
At this point, the code fails with the following traceback:
WARNING: FITSFixedWarning: 'celfix' made the change 'Unrecognized projection code (-SI in CTYPE2)'. [astropy.wcs.wcs]
---------------------------------------------------------------------------
InconsistentAxisTypesError Traceback (most recent call last)
<ipython-input-22-cc051d3537d1> in <module>()
----> 1 astr = wcs.WCS(header)
/Users/davidrosario/anaconda/lib/python3.4/site-packages/astropy/wcs/wcs.py in __init__(self, header, fobj, key, minerr, relax, naxis, keysel, colsel, fix, translate_units, _do_set)
498
499 if _do_set:
--> 500 self.wcs.set()
501
502 for fd in close_fds:
InconsistentAxisTypesError: ERROR 4 in wcs_types() at line 2432 of file cextern/wcslib/C/wcs.c:
Unrecognized projection code (-SI in CTYPE2).
I can’t seem to find anything particularly strange in the header - it’s actually quite simple, with no distortion corrections needed. The value of the keyword CTYPE3 is possibly non-standard. However, even if I delete that keyword from the FITS header, I get the same problem. Given that the 2MASS images are widely used in the community, I was puzzled by this issue. Could you please let me know if I’ve done something incorrectly or suggest a fix?
Thanks very much for any help you could send me.
-- David Rosario