[AstroPy] pywcs issue

Yogesh Wadadekar yogesh@ncra.tifr.res...
Wed Mar 23 08:23:34 CDT 2011


I am trying to use pywcs for analysis of some FIRST survey radio data.
When I run the simple python test script (pasted at the bottom of 
this email) below on the FITS file:

00525+00130Z.fits

Note that the FITS file above has minimal WCS related headers extracted 
from the original FIRST data.

It is available at:

http://www.ncra.tifr.res.in/~yogesh/00525+00130Z.fits

I get strange results. The output of the script is:

project@yogesh:~$ python test.py
running pywcs version:1.10-4.7
Image:  00525+00130Z.fits
Input ra and dec:
12.742937 	0.263592
Ra and dec after conversion via wcs_sky2pix and wcs_pix2sky:
[ 12.742937] 	[ 0.263592]
Input ra and dec:
192.983075 	-0.1740946
Ra and dec after conversion via wcs_sky2pix and wcs_pix2sky:
[ 13.26637025] 	[ 0.25923741]

For  a RA/Dec lying within the image, the sky --> pix ---> sky conversion 
gives correct results, but for a position ~180 degrees away, wcs_sky2pix 
returns x,y within the image. wcs_pix2sky happily converts this x,y to a 
grossly incorrect RA,Dec.

I am completely perplexed about what is going on here.

Yogesh

Yogesh Wadadekar			 Tel: 91 20 25719238
National Centre for Radio Astrophysics   e-mail: yogesh@ncra.tifr.res.in
Post Bag 3, Ganeshkhind
Pune 411007, India

------------------------------------------------------------------------
#!/usr/bin/env python

import pywcs,pyfits

print 'running pywcs version:'+pywcs.__version__

image = '00525+00130Z.fits'
print 'Image: ',image

header = pyfits.getheader(image)
wcs= pywcs.WCS(header)

x, y = wcs.wcs_sky2pix(12.742937,0.263592,1)
ra, dec = wcs.wcs_pix2sky(x, y,1)
print 'Input ra and dec:\n',12.742937,'\t',0.263592,'\nRa and dec after 
conversion via wcs_sky2pix and wcs_pix2sky:\n',ra,'\t',dec

# Now repeat with ra,dec pair for a position well outside the image
x, y = wcs.wcs_sky2pix(192.983075,-0.1740946,1)
ra, dec = wcs.wcs_pix2sky(x, y,1)
print 'Input ra and dec:\n',192.983075,'\t', -0.1740946,'\nRa and dec 
after conversion via wcs_sky2pix and wcs_pix2sky:\n',ra,'\t',dec


More information about the AstroPy mailing list