[AstroPy] question on fits header entry on WCS

Masato Onodera masato.onodera@gmail....
Thu Jun 27 11:51:50 CDT 2013


Hello,

I have a fits image with 1225x1326 pixels and header section seen in the
following URL: https://gist.github.com/monodera/e3d95d2bcdc8afcf860a
The wcs information of the image has been put with ccmap in IRAF.

Then I wrote a script to derive RA and Dec from pixel coordinates.


import numpy as np
import astropy.io.fits as fits
import astropy.wcs as wcs

hdu = fits.open('testimage.fits')
w = wcs.WCS(hdu[0].header)

pixcrd = np.array([[128, 128],
                   [hdu[0].header['NAXIS1']/2, hdu[0].header['NAXIS2']/2],
                   [1024,1024]], np.float_)

world = w.wcs_pix2world(pixcrd, 1)

print(world)


With this code, I got the following output.

WARNING: FITSFixedWarning: RADECSYS= 'FK5 ' / Equatorial coordinate system
RADECSYS is non-standard, use RADESYSa. [astropy.wcs.wcs]
WARNING: FITSFixedWarning: PROJP1 = 0.0 / Projection Type of the first axis
Defunct PROJPn keyword rejected. [astropy.wcs.wcs]
WARNING: FITSFixedWarning: PROJP2 = 0.0 / Projection Type of the second
axis Defunct PROJPn keyword rejected. [astropy.wcs.wcs]
WARNING: FITSFixedWarning: PC001001= -0.939693 / Coordinate translation
matrix Defunct form of PCi_ja keyword. [astropy.wcs.wcs]
WARNING: FITSFixedWarning: PC001002= 0.342020 / Coordinate translation
matrix Defunct form of PCi_ja keyword. [astropy.wcs.wcs]
WARNING: FITSFixedWarning: PC002001= 0.342020 / Coordinate translation
matrix Defunct form of PCi_ja keyword. [astropy.wcs.wcs]
WARNING: FITSFixedWarning: PC002002= 0.939693 / Coordinate translation
matrix Defunct form of PCi_ja keyword. [astropy.wcs.wcs]
WARNING: FITSFixedWarning: 'datfix' made the change 'Changed '2013-04-29
     ' to '2013-04-29T00:00:00.0''. This FITS header contains non-standard
content. [astropy.wcs.wcs]
WARNING: FITSFixedWarning: 'unitfix' made the change 'Changed units:
'degree            ' -> 'deg', 'degree            ' -> 'deg''. This FITS
header contains non-standard content. [astropy.wcs.wcs]
[[ 286.2970047   -60.82647447]
 [ 268.12706319   -0.58471502]
 [ 127.71449436   66.63600366]]


However, other programs which can convert coorinates such as ds9 and xy2sky
from wcstools give the following output and this is actually what I expect.

$ xy2sky -d testimage.fits 128 128 612 663 1024 1024
222.31848   8.92023 J2000  128.000  128.000
222.31446   8.93005 J2000  612.000  663.000
222.31055   8.93710 J2000 1024.000 1024.000


Then I found that "w = wcs.WCS(hdu[0].header, relax=False)" gives the
expected result.  Since I want to make a figure with APLpy and it
apparently does not accept "relax=False", I would like to know which header
entries cause the wrong result when I put "relax=True" and how to fix it.
 I guess they would be the entries mentioned in the warning messages, but
I'm not sure exactly...

Thank you in advance.


Masato Onodera
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/astropy/attachments/20130627/1ca55a15/attachment.html 


More information about the AstroPy mailing list