ejeschke / ginga

The Ginga astronomical FITS file viewer
BSD 3-Clause "New" or "Revised" License
121 stars 77 forks source link

WCS not being recognized #49

Closed ppmim closed 10 years ago

ppmim commented 10 years ago

Loading a FITS file the WCS is not recognized and the stderr shows some messages as follow:

2014-09-25 09:12:16,245 | W | example2_qt.py:158 (motion) | Bad coordinate conversion: 'NoneType' object has no attribute 'all_pix2world'

2014-09-25 09:12:25,277 | W | example2_qt.py:158 (motion) | Bad coordinate conversion: RA (2165.552846) > 360.0

Find examples at ftp://ftp.iaa.es/pub/jmiguel/osn.

ejeschke commented 10 years ago

This one seems easy to debug. Ginga tries to make a guess at the proper coordinate type to use based on the FITS header. Basically, right now it is looking for a "CTYPE1" keyword, and if it not found, gives up.

@ppmim, ds9 seems to assume this is an FK5 image. Is that a fair characterization? How do we know the projection type? Is it a reasonable heuristic in the absence of CTYPE to assume that if there are RA and DEC keywords to go to FK4/FK5 by any dates found?

ejeschke commented 10 years ago

@ppmim, astropy doesn't seem to build a wcs that is able to do a pixel to coordinates mapping from the straight header of the files from this instrument. I also tried with kapteyn and failed. Do you have to massage the headers to get a wcs that can do pixel/coordinate mapping?

ppmim commented 10 years ago

The instrument has a multi-detector with 4x2kx2k and mainly produces two kind of FITS files, the one you have with no WCS (only RA,DEC) and with the 4-detector images glued in a single HDU; and MEF files with the proper WCS. The latter are WCS properly recognized in Ginga; in the former (non MEF), we have not included any WCS information because of the 167 pixels gap between the detectors.

ejeschke commented 10 years ago

@ppmim, Ok, not sure what to think about this then. It seems like the other astro packages I've tried don't try to make a sensible WCS out of a FITS file that doesn't have one, so maybe we can just close this issue with the label "invalid"? Be sure to let me know if you have any FITS files that you think DO have a valid WCS that don't open correctly.

BTW, this is exactly the kind of file for which we would write a Ginga plugin here at Subaru Telescope. Something to remove the overscan region and set a valid WCS. I can advise you on that if you are interested.