pythonwarningsastropyfits

What does it mean that a card is fixed to meet FITS standard?


I am trying to use a FITS file. I have the following code:

from astropy.io import fits
from astropy.wcs import WCS

hdul = fits.open(fitsfilename)[0]

wcs = WCS(hdul.header)

It gives me these warnings:

WARNING: VerifyWarning: Verification reported errors: [astropy.io.fits.verify]
WARNING: VerifyWarning: Card 'A_2_0' is not FITS standard (invalid value string: '3.29341755408e-05'). Fixed 'A_2_0' card to meet the FITS standard. [astropy.io.fits.verify]
WARNING: VerifyWarning: Note: astropy.io.fits uses zero-based indexing.  [astropy.io.fits.verify]
WARNING: VerifyWarning: Card 'A_1_1' is not FITS standard (invalid value string: '1.51709339878e-05'). Fixed 'A_1_1' card to meet the FITS standard. [astropy.io.fits.verify]
WARNING: VerifyWarning: Card 'A_0_2' is not FITS standard (invalid value string: '5.17973753556e-06'). Fixed 'A_0_2' card to meet the FITS standard. [astropy.io.fits.verify]
WARNING: VerifyWarning: Card 'B_2_0' is not FITS standard (invalid value string: '2.97627426087e-06'). Fixed 'B_2_0' card to meet the FITS standard. [astropy.io.fits.verify]
WARNING: VerifyWarning: Card 'B_1_1' is not FITS standard (invalid value string: '2.71948126373e-05'). Fixed 'B_1_1' card to meet the FITS standard. [astropy.io.fits.verify]
WARNING: VerifyWarning: Card 'B_0_2' is not FITS standard (invalid value string: '1.66848449653e-05'). Fixed 'B_0_2' card to meet the FITS standard. [astropy.io.fits.verify]
WARNING: VerifyWarning: Card 'AP_1_0' is not FITS standard (invalid value string: '1.79541533196e-06'). Fixed 'AP_1_0' card to meet the FITS standard. [astropy.io.fits.verify]
WARNING: VerifyWarning: Card 'AP_0_1' is not FITS standard (invalid value string: '9.20624843151e-07'). Fixed 'AP_0_1' card to meet the FITS standard. [astropy.io.fits.verify]
WARNING: VerifyWarning: Card 'AP_2_0' is not FITS standard (invalid value string: '-3.29292923201e-05'). Fixed 'AP_2_0' card to meet the FITS standard. [astropy.io.fits.verify]
WARNING: VerifyWarning: Card 'AP_1_1' is not FITS standard (invalid value string: '-1.51738446887e-05'). Fixed 'AP_1_1' card to meet the FITS standard. [astropy.io.fits.verify]
WARNING: VerifyWarning: Card 'AP_0_2' is not FITS standard (invalid value string: '-5.18321445978e-06'). Fixed 'AP_0_2' card to meet the FITS standard. [astropy.io.fits.verify]
WARNING: VerifyWarning: Card 'BP_1_0' is not FITS standard (invalid value string: '8.99029048217e-07'). Fixed 'BP_1_0' card to meet the FITS standard. [astropy.io.fits.verify]
WARNING: VerifyWarning: Card 'BP_0_1' is not FITS standard (invalid value string: '1.15967736014e-06'). Fixed 'BP_0_1' card to meet the FITS standard. [astropy.io.fits.verify]
WARNING: VerifyWarning: Card 'BP_2_0' is not FITS standard (invalid value string: '-2.97837492348e-06'). Fixed 'BP_2_0' card to meet the FITS standard. [astropy.io.fits.verify]
WARNING: VerifyWarning: Card 'BP_1_1' is not FITS standard (invalid value string: '-2.71998518336e-05'). Fixed 'BP_1_1' card to meet the FITS standard. [astropy.io.fits.verify]
WARNING: VerifyWarning: Card 'BP_0_2' is not FITS standard (invalid value string: '-1.66872388359e-05'). Fixed 'BP_0_2' card to meet the FITS standard. [astropy.io.fits.verify]
WARNING: VerifyWarning: Card 'WCSR_PRJ' is not FITS standard (invalid value string: '3.6679e-07'). Fixed 'WCSR_PRJ' card to meet the FITS standard. [astropy.io.fits.verify]
WARNING: VerifyWarning: Card 'WCSR_PIX' is not FITS standard (invalid value string: '8.2565e-05'). Fixed 'WCSR_PIX' card to meet the FITS standard. [astropy.io.fits.verify]

What does it mean that Fixed 'A_2_0' card to meet the FITS standard? What happened with the data to which the card A_2_0 is referring to? I am also interested in the meaning of WARNING: VerifyWarning: Note: astropy.io.fits uses zero-based indexing.


Solution

  • io.fits has functionality for verifying the validity of headers, and will even fix minor trivial formatting errors (it tries its best to only write perfectly valid FITS files as best possible).

    Although there are options for how to perform verification at the time of writing out a file, there are also some cases where it performs automatic verification at read time too, particularly while parsing the headers. It's a long standing open issue (this is just one related example; there are several) that there's no great way currently to control for read-time verification / fixups. It might be nice to have an easier way to silence this, or disable it altogether. I think this would not be too hard to fix, just no one has ever been sufficiently motivated I guess. Although currently, if you wish to silence the warnings, you can do so with the standard Python warnings system.

    With that out of the way, as to the meanings of the warnings themselves, I think it's probably the use of e instead of E in scientific notation (the FITS standard goes back to days of FORTRAN where the latter was more common I think). It would be nice if the message explained better exactly what it was fixing.

    Note: astropy.io.fits uses zero-based indexing. is technically just part of the first warning message, and is there mostly for historical reasons. The fact that it was added to this message is a bit of a bug even, since the message does even mention any indices (in the past it might have said something about "Error in card [N]", where N would be an index of the card). The reason for this message was just as a reminder to users who were more accustomed to FORTRAN and/or IRAF, which uses 1-based indexing, whereas PyFITS/astropy.io.fits gives HDU numbers and header card numbers using 0-based indexing as used by C and Python. At this point it could probably be removed, or at least fixed to only be appended to warning messages to which it's actually relevant.