[AstroPy] WCS query

Perry Greenfield perry at stsci.edu
Wed Jun 15 10:16:01 CDT 2005


Hi Steve,

I have a feeling this is related to your matplotlib query.

On Jun 10, 2005, at 7:57 PM, Stephen Walton wrote:

> Hi,
>
> 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:
>
The above suggests you were associating x coordinates with the first 
index and y with the second. Of course with numarray (and Numeric) 
that's wrong. Is this the crux of the problem?

> xx = cd[0,0]*(x-crpix1+1) + cd[0,1]*(y-crpix2+1)
> yy=cd[1,0]*(x-crpix1+1)+cd[1,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
>
> contour(image)
> contour(xx,[-1,0,1])
> contour(yy,[-1,0,1])
>
> 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?
>
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.net
> http://www.scipy.net/mailman/listinfo/astropy




More information about the AstroPy mailing list