[AstroPy] Problems constructing astropy.wcs.WCS object from multi-plane 2MASS images

Peter Erwin erwin at mpe.mpg.de
Fri Jul 7 06:12:41 EDT 2017


Hi,

I'm having trouble constructing WCS objects from 2MASS galaxy images.
(My goal is to determine the pixel coordinates of the galaxy center in the
J-band images, given the RA and Dec from e.g. NED or HyperLeda.)

For single-filter images from the 2MASS Large Galaxy Atlas, the following
works just fine:
>>> imdata,hdr = fits.getdata(fits_filename, header=True)
>>> wcsObj = astropy.wcs.WCS(header=hdr)


But for galaxies not in the Large Galaxy Atlas, using the "datacube" JHK images (obtained via NED), 
produces this error:

>>> imdata,hdr = fits.getdata(fits_filename, header=True)
>>> wcsObj = astropy.wcs.WCS(header=hdr)
WARNING: FITSFixedWarning: 'celfix' made the change 'Unrecognized projection code (-SI in CTYPE2)'. [astropy.wcs.wcs]
---------------------------------------------------------------------------
InconsistentAxisTypesError                Traceback (most recent call last)
<ipython-input-123-a63c9d39ae30> in <module>()
----> 1 wcsObj = astropy.wcs.WCS(header=hdr)

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/astropy/wcs/wcs.py in __init__(self, header, fobj, key, minerr, relax, naxis, keysel, colsel, fix, translate_units, _do_set)
    502 
    503         if _do_set:
--> 504             self.wcs.set()
    505 
    506         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).


This is puzzling, because the headers for both the Large Galaxy Atlas images and the
JHK datacubes seem to be very similar; in particular, the CTYPE2 header keyword
is 'DEC--SIN' for both sorts of image.


Here's the header from a Large Galaxy Atlas image:

SIMPLE  =                    T
BITPIX  =                  -32
NAXIS   =                    2
NAXIS1  =                  800
NAXIS2  =                  800
BLOCKED =                    T / TAPE MAY BE BLOCKED IN MULTIPLES OF 2880
EXTEND  =                    T / TAPE MAY HAVE STANDARD FITS EXTENSIONS
BSCALE  =                   1.
BZERO   =                   0.
ORIGIN  = '2MASS   '           / 2MASS Survey Camera
CTYPE1  = 'RA---SIN'
CTYPE2  = 'DEC--SIN'
CRPIX1  =                400.5
CRPIX2  =                400.5
CRVAL1  =           23.5757103
CRVAL2  =         -29.41875076
CDELT1  =     -0.0002777777845
CDELT2  =      0.0002777777845
CROTA2  =                   0.
EQUINOX =                2000.
JMAGZP  =          20.98749924 /   V3 Photometric zero point calibration
COMMENTC= 'CAL updated by T.H. Jarrett, IPAC/Caltech'
SIGMA   =         0.7034527063 /   Background Residual RMS noise (dn)
COMMENT1= '2MASS mosaic image'
COMMENT2= 'created by T.H. Jarrett, IPAC/Caltech'
END


And here's the header for a typical JHK datacube (note that it actually
has *six* image planes: the first three are sky-subtracted J, H, and K, while
the second three are sky-and-star-subtracted J, H, and K):

SIMPLE  =                    T
BITPIX  =                  -32
NAXIS   =                    3
NAXIS1  =                  301
NAXIS2  =                  301
NAXIS3  =                    6
BLOCKED =                    T / TAPE MAY BE BLOCKED IN MULTIPLES OF 2880
EXTEND  =                    T / TAPE MAY HAVE STANDARD FITS EXTENSIONS
ORIGIN  = '2MASS   '           / 2MASS Survey Camera
TELESCOP= '2MASS   '           / North=Mt.Hopkins,South=CTIO
GID     = '002433  '           / 2MASS ID #
NNAME   = 'NGC_3412'           / NED Cat Name
SCANNO  = '136     '           / Scan Number
COADDNO = '209     '           / Coadd Number
ORDATE  = '971215n '           / Observation Ref Date (yymmdd)
UTDATE  = '971215  '           / UT Date of Frame (IC) (yymmdd)
UT      = '12:42:44.02'        / Time of Frame (IC) (sxgsml)
DATE-OBS= '1997-12-15T12:42:44.02' / Observation Ref Date
EQUINOX =                2000. / Equinox
CTYPE1  = 'RA---SIN'           / Orthographic Projection
CTYPE2  = 'DEC---SIN'          / Orthographic Projection
CTYPE3  = 'JHKs cube'          / 1=J,2=H,3=Ks; 4=J,5=H,6=Ks
RA      =          162.7221375 / RA  at Frame Center, J2000 (deg)
DEC     =           13.4121418 / Dec at Frame Center, J2000 (deg)
CRVAL1  =          162.7221375 / RA  at Frame Center, J2000 (deg)
CRVAL2  =           13.4121418 / Dec at Frame Center, J2000 (deg)
CRPIX1  =                 151. / Axis 1 Reference Pixel
CRPIX2  =                 151. / Axis 2 Reference Pixel
CROTA2  =       0.002134113805 / Image Twist  E of N, J2000 (deg)
CDELT1  =     -0.0002777777845 / Axis 1 Pixel Size (deg)
CDELT2  =      0.0002777777845 / Axis 2 Pixel Size (deg)
JSKYVAL =           53.5084343 / GALWORKS J Sky Measurement
JSKYSIG =         0.4580373764 / GALWORKS J Noise Measurement
HSKYVAL =          281.6602478 / GALWORKS H Sky Measurement
HSKYSIG =         0.8120117188 / GALWORKS H Noise Measurement
KSKYVAL =          260.6483765 / GALWORKS K Sky Measurement
KSKYSIG =         0.8488883972 / GALWORKS K Noise Measurement
CALID   = ' V3-CALIBRATED'     / Calibration ID
JSEESH  =          1.052999973 / Seeing J shape parameter
HSEESH  =          1.018000007 / Seeing H shape parameter
KSEESH  =          1.034999967 / Seeing K shape parameter
JMAGZP  =              21.0540   / Calibrated J zero point from CALMAN
HMAGZP  =              20.6830   / Calibrated H zero point from CALMAN
KMAGZP  =              20.0540   / Calibrated K zero point from CALMAN
AMASS_FC=          1.052941084 / Airmass (aprox) at this position
COMMENT > Planes 1, 2 and 3 represent the background
COMMENT > subtracted images of the J, H and Ks bands;
COMMENT > Planes 4,5,6 represent the background **and**
COMMENT > star subtracted images of the J, H and Ks bands
HISTORY > GALWORKS Version 3
HISTORY > image created by galworks,  Tom Jarrett, IPAC/Caltech/JPL
END

Any suggestions?

cheers,

Peter

=============================================================
Peter Erwin                   Max-Planck-Insitute for Extraterrestrial 
erwin at mpe.mpg.de              Physics, Giessenbachstrasse
tel. +49 (0)176 2481 7713     85748 Garching, Germany
fax  +49 (0)89 30000 3495     http://www.mpe.mpg.de/~erwin





More information about the AstroPy mailing list