[AstroPy] WCS query

Stephen Walton stephen.walton at csun.edu
Fri Jun 10 18:57:24 CDT 2005


This seemed the best list to try to ask this on.  I have a 1024 square 
full disk solar image with a simple linear WCS which defines Bill 
Thompson's SOLX and SOLY coordinates:  x=0,y=1 is the solar N limb, 
x=1,y=0 is the solar W limb.  If I do the following in IRAF:

disp image 1 xs=0.8 ys=0.8 fill+
wcslab image 1 vl=0.1 vr=0.9 vb=0.1 vt=0.9 fill+

the WCS looks fine;  in particular, the (x=(0,1),y=(0,1)) contours are 
nicely tangent to the solar limb.

However, if I read the WCS with PyFITS and try to compute a WCS array in 
Python, things go wrong.  Here's what I did:  I created a 2x2 cd array 
in Python where cd[k-1,m-1] was set to CD_km from the FITS header; I 
also read CRPIX1 and CRPIX2 from the FITS header into crpix1 and crpix2 
variables.  Two arrays, x and y, were produced, where x[k,m]=k and 
y[k,m]=m, k,m=0,1023.  Finally, I created xx and yy as follows:

xx = cd[0,0]*(x-crpix1+1) + cd[0,1]*(y-crpix2+1)

(the +1 in the above is because crpix1 and crpix2 assume the array 
indexing is one-based, not zero-based).  Then, using matplotlib, I did


The lines at +1 and -1 are definitely not tangent to the limb.  The 
strange thing is, if I do xx.transpose() and yy.transpose() and repeat 
the above three matplotlib commands the +1 and -1 lines are tangent to 
the limb.  Since the image is both off center and tilted with respect to 
solar N-S, this cannot be a coincidence.

Can anyone enlighten me as to what went wrong here?

More information about the AstroPy mailing list