[AstroPy] WCS exception due to header keyword PLATEID

James Allen j.allen at physics.usyd.edu.au
Thu Jan 21 00:13:24 EST 2016


Hi,

I'm having a problem with WCS() raising an exception for what looks to me
like a perfectly valid FITS header. The issue appears to be that the header
includes a PLATEID, which in this case is completely unrelated to the
coordinates. When I delete that card from the header, WCS() works fine. Is
astropy interpreting PLATEID as being related to distortion in some way? I
couldn't find it in the FITS WCS specifications anywhere. Is there any way
to get it to ignore this card without deleting it? Obviously I could just
pass the first N lines of the header to WCS(), but that seems pretty
fragile.

The header [with irrelevant lines replaced by ...] and exception are copied
below. I'm using v1.1.1 of astropy in Python 2.7.

Thanks,
James


In [52]: header = fits.getheader('10000089/10000089_red_4.fits')

In [53]: header
Out[53]:
SIMPLE  =                    T / conforms to FITS standard

BITPIX  =                  -64 / array data type

NAXIS   =                    3 / number of array dimensions

NAXIS1  =                   50

NAXIS2  =                   50

NAXIS3  =                 2048

EXTEND  =                    T

WCSAXES =                    3 / Number of coordinate axes

CRPIX1  =                 25.5 / Pixel coordinate of reference point

CRPIX2  =                 25.5 / Pixel coordinate of reference point

CRPIX3  =               1024.0 / Pixel coordinate of reference point

CDELT1  =   -0.000138888888889 / [deg] Coordinate increment at reference
point
CDELT2  =    0.000138888888889 / [deg] Coordinate increment at reference
point
CDELT3  =    0.568812591597500 / [m] Coordinate increment at reference
point
CUNIT1  = 'deg     '           / Units of coordinate increment and value

CUNIT2  = 'deg     '           / Units of coordinate increment and value

CUNIT3  = 'Angstrom'           / Units of coordinate increment and value

CTYPE1  = 'RA---TAN'           / Right ascension, gnomonic projection

CTYPE2  = 'DEC--TAN'           / Declination, gnomonic projection

CTYPE3  = 'AWAV'               / Air wavelength (linear)

CRVAL1  =        175.104583000 / [deg] Coordinate value at reference point

CRVAL2  =         -0.828278000 / [deg] Coordinate value at reference point

CRVAL3  =       6843.014421829 / [m] Coordinate value at reference point

...
PLATEID = 'Y13SAR1_P015_12T014_15T023' / Plate ID (from config file)

...

In [54]: WCS(header)
ERROR: MemoryError: NAXES was not set (or bad) for  distortion on axis 3
[astropy.wcs.wcs]
---------------------------------------------------------------------------
MemoryError                               Traceback (most recent call last)
<ipython-input-54-d421f8424c5e> in <module>()
----> 1 WCS(header)

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/astropy/wcs/wcs.pyc
in __init__(self, header, fobj, key, minerr, relax, naxis, keysel, colsel,
fix, translate_units, _do_set)
    419                 tmp_wcsprm = _wcs.Wcsprm(header=tmp_header_bytes,
key=key,
    420                                          relax=relax,
keysel=keysel_flags,
--> 421                                          colsel=colsel,
warnings=False)
    422             except _wcs.NoWcsKeywordsFoundError:
    423                 est_naxis = 0

MemoryError: NAXES was not set (or bad) for  distortion on axis 3

In [55]: del header['PLATEID']

In [56]: WCS(header)
Out[56]:
WCS Keywords

Number of WCS axes: 3
CTYPE : 'RA---TAN'  'DEC--TAN'  'AWAV'
CRVAL : 175.10458299999999  -0.82827799999999996  6.8430144218290003e-07
CRPIX : 25.5  25.5  1024.0
PC1_1 PC1_2 PC1_3  : 1.0  0.0  0.0
PC2_1 PC2_2 PC2_3  : 0.0  1.0  0.0
PC3_1 PC3_2 PC3_3  : 0.0  0.0  1.0
CDELT : -0.00013888888888899999  0.00013888888888899999
 5.6881259159749997e-11
NAXIS    : 50 50
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20160121/dd31c84d/attachment.html>


More information about the AstroPy mailing list