[AstroPy] Error in pixel to sky coordinate conversion with astropy.wcs

Angelo Varlotta avarlotta at cfa.harvard.edu
Tue Apr 29 13:20:39 EDT 2014


Hello,
I need to convert a list of sources from pixel coordinates to sky
coordinates for some PAIRITel data,using astropy (0.3.1) and using the
following code:

from __future__ import division
import numpy
from astropy import wcs
from astropy.io import fits
import sys

hdulist = fits.open(sys.argv[-1])
w = wcs.WCS(hdulist[0].header)
pixcrd = numpy.array([[0,0],[24,38],[45,98]], numpy.float_)
world = w.wcs_pix2world(pixcrd, 1)
print world

(the fits file is at h_long_CYGX3.1.11_coadd.fits
<https://db.tt/TfTbSBRH>, the code is in a file I called pix2sky.py)

The code derives from the first example in the documentation for
astropy.wcs at: http://docs.astropy.org/en/stable/wcs/index.html. While
I can do this sucessfully with a fits file generated from Fermi analysis
(so I know that astropy is installed properly and works), with the
PAIRITel data I get the following error message, after running from the
terminal prompt python pix2sky.py h_long_CYGX3.1.11_coadd.fits:


WARNING: FITSFixedWarning: RADECSYS= 'ICRS ' / Astrometric system
RADECSYS is non-standard, use RADESYSa. [astropy.wcs.wcs]
WARNING: FITSFixedWarning: 'datfix' made the change 'Invalid parameter
value: invalid date '2010/5/14 09:23:52''. [astropy.wcs.wcs]
WARNING: FITSFixedWarning: 'celfix' made the change 'PV1_5 :
Unrecognized coordinate transformation parameter'. [astropy.wcs.wcs]

Traceback (most recent call last):
  File "pix2sky.py", line 49, in <module>
    load_wcs_from_file(sys.argv[-1])
  File "pix2sky.py", line 36, in load_wcs_from_file
    world = w.wcs_pix2world(pixcrd, 1)
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/astropy-0.3.1-py2.7-macosx-10.9-x86_64.egg/astropy/wcs/wcs.py",
line 1159, in wcs_pix2world
    'output', *args, **kwargs)
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/astropy-0.3.1-py2.7-macosx-10.9-x86_64.egg/astropy/wcs/wcs.py",
line 1060, in _array_converter
    return _return_single_array(xy, origin)
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/astropy-0.3.1-py2.7-macosx-10.9-x86_64.egg/astropy/wcs/wcs.py",
line 1044, in _return_single_array
    result = func(xy, origin)
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/astropy-0.3.1-py2.7-macosx-10.9-x86_64.egg/astropy/wcs/wcs.py",
line 1158, in <lambda>
    lambda xy, o: self.wcs.p2s(xy, o)['world'],
astropy.wcs._wcs.InvalidTransformError: ERROR 6 in wcsset() at line 1562
of file cextern/wcslib/C/wcs.c:
PV1_5 : Unrecognized coordinate transformation parameter.


How do I proceed?

Cheers,
Angelo

Angelo Varlotta
Smithsonian Astrophysical Observatory
60 Garden St. MS-06, Cambridge, MA 02138, USA
Phone: +1-617-495-7138
Office: B-226
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20140429/5b6823c4/attachment.html>


More information about the AstroPy mailing list