From: Stephen W. <ste...@cs...> - 2005-06-15 23:03:02
|
Humufr wrote: > I think that the problem is more that when you're using matshow to > draw a fits file read with pyfits you don't have the same image if you > open the fits file with ds9, the y axis is inverted. Yes, but even that is an illusion as it were. See below. > import pyfits > > scidata = pyfits.open('test.fits')[0].data > matshow(scidata) > > ylim(0,scidata.shape[0]) It is easier to use imshow(scidata,origin='lower') here. But the fact that the image then looks the same when displayed in matplotlib and ds9 is something of a fluke. ds9 displays the first FITS index increasing horizontally and the second increasing vertically (no reason not to, it's just a convention). PyFITS effectively transposes the array when it is read, but imshow() puts the first array index vertical. The result is that the image orientation looks the same when displayed in ds9 or matplotlib even though pixel (x,y) as displayed in ds9 is scidata[y-1,x-1] in Python. I was badly confused by this earlier in the week when checking some image coordinate computations in Python against the original Fortran IRAF code. Hence my first post. |