Search code examples
pythonastropyfits

Problems with FITS header


I've asked this on astronomy.se as well.

I'm working with some NEOWISE images that seem to have incomplete header tags. I've been advised by the SAO (because I'm using DS9 to view them) that I have

"a partial PC matrix defined, yet it does not conform to the FITS WCS standard. With a combo of CDELT and PC keywords, the CDELT keywords hold the scaling factor, the PC keywords, the rotation matrix, which should be normalized. If you want the rotation matrix to also contain the scale factor, use CD keywords".

Here's one of the headers I need to fix:

SIMPLE  =                    T / conforms to FITS standard                      
BITPIX  =                  -32 / array data type                                
NAXIS   =                    2 / number of array dimensions                     
NAXIS1  =                 1459                                                  
NAXIS2  =                  903                                                  
WCSAXES =                    2 / Number of coordinate axes                      
CRPIX1  =                729.5 / Reference pixel for axis 1                     
CRPIX2  =                451.5 / Reference pixel for axis 2                     
PC1_1   =     -0.0333333333333 / Coordinate transformation matrix element       
PC2_2   =      0.0333333333333 / Coordinate transformation matrix element       
CDELT1  =                   1. / [deg] Coordinate increment at reference point  
CDELT2  =                   1. / [deg] Coordinate increment at reference point  
CUNIT1  = 'deg     '           / Units of coordinate increment and value        
CUNIT2  = 'deg     '           / Units of coordinate increment and value        
CTYPE1  = 'GLON-AIT'           / Projection for axis1                           
CTYPE2  = 'GLAT-AIT'           / Projection for axis1                           
CRVAL1  =                   0. / [deg] Coordinate value at reference point      
CRVAL2  =                   0. / [deg] Coordinate value at reference point      
LONPOLE =                   0. / [deg] Native longitude of celestial pole       
LATPOLE =                  90. / [deg] Native latitude of celestial pole        
RADESYS = 'ICRS    '           / Equatorial coordinate system                   
BAND    = 'W1      '           / Wise Band                                      
END

I've already managed to fix a couple of the invalid tags, but apart from these minor edits, this is unaltered from the file that my research supervisor gave me. The FITS standard here gives descriptions of each of the tags, but I'm not sure how to implement the SAO's advice. Can anyone help me fix the tags?


Solution

  • Following the error message, if the PCi_j format is used to describe the rotation matrix, the values should be normalised to 1, and any scaling factor encoded separately in the CDELT values. If one wants to include the scaling factor in the rotation matrix, the CDi_j format should be used, without any CDELT values. In the draft v4.0 FITS specification, the relevant section in the FITS standard is on p.29 around eqs. 9-11: https://fits.gsfc.nasa.gov/standard40/fits_standard40draft1.pdf

    Two possible solutions exist. First, the scaling can be transferred to the CDELT values like so:

    PC1_1 = -1.0
    PC2_2 = 1.0
    CDELT1 = 0.0333333333333
    CDELT2 = 0.0333333333333
    

    Alternatively, one could delete the CDELT values and rename the PC1_1 and PC2_2 to CD1_1 and CD2_2.

    Note that it is valid to exclude PC1_2 and PC2_1, hence the message noting "a partial PC matrix [is] defined", as the off-diagonal values default to zero (defined on p.32 of the document linked above) which appears to be the desired effect.