You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I am a julia rookie, so I lost a fair time to discover that the inconsistent results I got from a FITS file produced by a colleague were due to using the WCS routines (the problem probably can lie in the header of the file but I am not expert in this)
The fits file contains a 4096 x 2048 array to be plotted. The projection is such that RA grows "to left" in pix space but it is wrapped around about 288 RA deg for projection purposes (so the origin RA=0 is not centered at 2048.5). DEC range is the standard [-90,90]. Exact WCSTransform is accluded below.
Both going from world coords to pixels or back has problems.
I acclude results from one simple tests, comparing them with an approximate "by hand" transform from RA to pix that the colleague gave me (the latter is off by 0.5 deg but this is unimportant here) and the correct results by using python astropy6.0.0 (the outputs in this case have RA <0, so need to wrap around them by adding 360)
Oddily, the Julia WCS routine yields mostly null outputs.
I suspect that the WCS from the file might miss some info that can avoid the incorrect behaviour but I have no idea about and I puzzle why astropy instead gives correct results.
---- failing WCSTransform ----
after reading from the file, the full header is
SIMPLE = T
BITPIX = -64
NAXIS = 2
NAXIS1 = 4096
NAXIS2 = 2048
EXTEND = T / FITS dataset may contain extensions
COMMENT FITS (Flexible Image Transport System) format is defined in 'Astronom
COMMENT and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H
CTYPE1 = 'RA---CAR'
CTYPE2 = 'DEC--CAR'
CRVAL1 = -252.0
CRVAL2 = 0.0
CRPIX1 = 2048.5 / Reference Pixel in X
CRPIX2 = 1024.5 / Reference Pixel in Y
CDELT1 = -0.087890625
CDELT2 = 0.087890625
CROTA2 = 0.0
once the above header is read as a single string (please stress this point in the info, it took me a while to find out why the header if read without reading it with the String keyword was failing)
I get:
-------------------- (culprit?) WCSTransform
The issue is related to the use of 12 x 2 matrix for the list of coordinates (radecmatorigabove) instead of a 2 x 12 matrix. This creates the wrong result in the world_to_pix transformation.
Essentially, this kind of mistakes happen because the library is quite a thin wrapper to the C WCS library, with very little checks for input parameters.
Hello, I am a julia rookie, so I lost a fair time to discover that the inconsistent results I got from a FITS file produced by a colleague were due to using the WCS routines (the problem probably can lie in the header of the file but I am not expert in this)
The fits file contains a 4096 x 2048 array to be plotted. The projection is such that RA grows "to left" in pix space but it is wrapped around about 288 RA deg for projection purposes (so the origin RA=0 is not centered at 2048.5). DEC range is the standard [-90,90]. Exact WCSTransform is accluded below.
Both going from world coords to pixels or back has problems.
I acclude results from one simple tests, comparing them with an approximate "by hand" transform from RA to pix that the colleague gave me (the latter is off by 0.5 deg but this is unimportant here) and the correct results by using python astropy6.0.0 (the outputs in this case have RA <0, so need to wrap around them by adding 360)
Oddily, the Julia WCS routine yields mostly null outputs.
I suspect that the WCS from the file might miss some info that can avoid the incorrect behaviour but I have no idea about and I puzzle why astropy instead gives correct results.
---- failing WCSTransform ----
after reading from the file, the full header is
once the above header is read as a single string (please stress this point in the info, it took me a while to find out why the header if read without reading it with the String keyword was failing)
I get:
-------------------- (culprit?) WCSTransform
------------------ test code - (copied form notebook, output below)
---- julia output ------
------ same conversion done successfully in python
....... imports, reads etc....
---- output # Correct
The text was updated successfully, but these errors were encountered: