1

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.

zabop
  • 3,885
  • 3
  • 14
  • 47
  • Thats not explaining it, but thanks for the effort – zabop Jan 09 '19 at 14:14
  • really? because that link explains what's happening and what options you can take around those warnings – gold_cy Jan 09 '19 at 14:17
  • 1
    look carefully here --> http://docs.astropy.org/en/stable/io/fits/usage/verification.html#verification-at-each-card before trying to dismiss the link it clearly states that your input data containing lowercase `e` is not valid and had to be changed to `E` in order to comply with the FITS standard – gold_cy Jan 09 '19 at 14:20
  • Ok thats useful thanks. – zabop Jan 09 '19 at 14:23
  • May I suggest to edit your first link, since it is pointing to "Verification using the FITS Checksum Keyword Convention" - which is clearly not the issue. – zabop Jan 09 '19 at 14:23
  • can't edit a comment that old, I must have inadvertently linked to that portion of the page when I meant to link to the page in general, regardless that was the first link that came up when doing a quick google search – gold_cy Jan 09 '19 at 14:25
  • why don’t you try researching your problem first next time and then this whole situation becomes avoided – gold_cy Jan 09 '19 at 14:29

1 Answers1

2

As already noted in the comments, 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.

The note "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.

Iguananaut
  • 15,675
  • 4
  • 43
  • 50