Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDUList.verify() "misses" invalid cards? #5909

Open
josePhoenix opened this issue Mar 24, 2017 · 3 comments
Open

HDUList.verify() "misses" invalid cards? #5909

josePhoenix opened this issue Mar 24, 2017 · 3 comments
Labels

Comments

@josePhoenix
Copy link
Contributor

josePhoenix commented Mar 24, 2017

A colleague reports constructing a FITS file with an invalid header card (ABCDEFGH = unquotedstringliteral ) and seeing unexpected behavior.

On opening:

In [6]: hdul = fits.open('/user/vbajaj/1141601ai_dkc.fits')
WARNING: The following header keyword is invalid or follows an unrecognized non-standard convention:
ABCDEFGH = unquotedstringliteral                                                [astropy.io.fits.card]

However, when calling hdul.verify():

In [21]: hdul.verify('exception')

Calling _verify() on the Card itself similarly does not produce anything. It seems from the comments in the source that returning an empty error list is intentional: https://github.com/astropy/astropy/blob/master/astropy/io/fits/card.py#L1048-L1058

    def _verify(self, option='warn'):
        self._verified = True

        errs = _ErrList([])
        fix_text = ('Fixed {!r} card to meet the FITS '
                    'standard.'.format(self.keyword))

        # Don't try to verify cards that already don't meet any recognizable
        # standard
        if self._invalid:
            return errs

[...]

Thoughts?

(perhaps relevant to #3668)

@josePhoenix
Copy link
Contributor Author

cc @Vb2341

@mohanagr
Copy link
Contributor

This might be related to #5877 too. I have encountered a couple of issues with opening and updating of FITS file keywords.

@pllim pllim added the io.fits label Mar 25, 2017
@saimn
Copy link
Contributor

saimn commented Dec 12, 2017

@josePhoenix - As you pointed the card is marked as invalid and so it's ignored from the following checks. Which makes sense, since it is useless to verify something that is not valid, and you already get the warning when opening the file. Do you think it would be useful to have another warning/exception when verifying it ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants