[AstroPy] Pywcs not reading transformation matrix correctly

Oliver King ogk at astro.caltech.edu
Thu Jul 26 12:54:52 EDT 2012


Hi,

I've discovered what I think is a bug in the pywcs module in astropy. I have a FITS file with a WCS that contains these parameters:

CRVAL1  =        343.485065456 / RA  of reference point                         
CRVAL2  =        16.1466891384 / DEC of reference point                         
CRPIX1  =        1094.26737976 / X reference pixel                              
CRPIX2  =        1037.56068399 / Y reference pixel                              
CUNIT1  = 'deg     ' / X pixel scale units                                      
CUNIT2  = 'deg     ' / Y pixel scale units                                      
CD1_1   =   -7.75889930453E-05 / Transformation matrix                          
CD1_2   =     4.5042903792E-07 / no comment                                     
CD2_1   =    -3.9690360471E-07 / no comment                                     
CD2_2   =   -7.76314691533E-05 / no comment 

Notice that the transformation matrix parameters are in exponential notation. However, when I read the WCS using astropy I get these parameters:

In [14]: wcs.printwcs()
WCS Keywords

CD_11  CD_12: -7.7588993045299999 4.5042903790000004
CD_21  CD_22: -3.9690360400000002 -7.7631469099999997
CRVAL    : 343.48506545599997 16.146689138399999
CRPIX    : 1094.26737976 1037.5606839
NAXIS    : 2048 2048

It has ignored the exponential notation. If I manually edit the transformation matrix parameters in the header to remove the exponential notation it reads in the WCS correctly.

Is this a known bug? Is there a workaround or do I need to manually edit my FITS file headers?

Cheers,
Oliver

------
Oliver King
Astronomy Department, Caltech
+1-626-395-4197




More information about the AstroPy mailing list