Skip to content

Improve verification warnings/errors for FITS header values #3668

Open

Description

@embray

A recent thread on astropy-dev prompted some thoughts on things that could be improved in header verification.
There are already several issues related to this: #3603, #3497, #887, #873, and perhaps others.

What I want to specifically address in this issue is unhelpful VerifyError messages. In the case of the linked astropy-dev thread, the error was:

Card 'ESO DET CHIP PXSPACE' is not FITS standard (invalid value string: '2.000e-05 / Pixel-Pixel Spacing').

To begin with, this is misleading. What's being reported as the "value string" is actually the value and the comment--these are passed in, combined, to a single regular expression that breaks it into the value and the comment portions. If this regexp fails then this error is reported. However, there is no way, as currently implemented, for it to specify which part of the string is invalid. It might be possible to fix this by testing for a number of specific common problems; I could probably think of many classes of problems that can be checked for after the initial check fails. In the meantime there are several other things that can be improved about this:

  1. Nowhere does it mention that calling .verify('fix') on the card, or passing verify='fix' to writeto()/close() might fix the issue. That should be fixed, and we should make sure there is a consistent message to that effect whenever verification errors are raised.

  2. It might be nice to automatically try .verify('fix') on any object that fails verification, and actually show the user what would be fixed as a diff, then suggest that they do that. Note, there is also the option to ignore verification errors; then at least non-critical errors in data can still be saved back out (not recommended, but still needed in some cases). Point being, fixes shouldn't automatically be applied to the data, but we can at least show the user what would be fixed. That could help in identifying where the issue is in the original data too.

Activity

  1. embray commented on May 23, 2016

    @embray
    MemberAuthor

    @hbouy It seems like maybe you deleted your comment. You should try uploading the file, or at least the header, to somewhere that someone can inspect it. If it's totally corrupt it may not be possible to fix automatically. Or it may be just slightly corrupt, but the automatic header fixing doesn't necessarily work for all possible errors.

  2. added 3 commits that reference this issue on Nov 30, 2020
  3. added a commit that references this issue on Dec 31, 2020
  4. added 2 commits that reference this issue on Feb 21, 2021
  5. added a commit that references this issue on Feb 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions