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

IFU_cube_continuum_fit data file has invalid header, please fix it #177

Open
pllim opened this issue May 20, 2022 · 0 comments
Open

IFU_cube_continuum_fit data file has invalid header, please fix it #177

pllim opened this issue May 20, 2022 · 0 comments

Comments

@pllim
Copy link
Contributor

pllim commented May 20, 2022

The primary header of https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/IFU_cube_continuum_fit/NGC4151_Hband.fits is invalid and needs to be fixed. You can see the following error when you access it.

>>> from astropy.io import fits
>>> from astropy.utils.data import download_file
>>> fn = download_file('https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/IFU_cube_continuum_fit/NGC4151_Hband.fits', cache=True)
>>> pf = fits.open(fn)
>>> pf[0].header['MODE']
.../astropy/io/fits/header.py in __getitem__(self, key)
    161             return card.rawvalue
    162
--> 163         value = card.value
    164         if value == UNDEFINED:
    165             return None

.../astropy/io/fits/card.py in value(self)
    284             value = self._value
    285         elif self._valuestring is not None or self._image:
--> 286             value = self._value = self._parse_value()
    287         else:
    288             if self._keyword == '':

.../astropy/io/fits/card.py in _parse_value(self)
    732
    733         if m is None:
--> 734             raise VerifyError("Unparsable card ({}), fix it first with "
    735                               ".verify('fix').".format(self.keyword))
    736

VerifyError: Unparsable card (MODE), fix it first with .verify('fix').

To fix it, run pf.verify('fix') and write it back out.

>>> pf.verify('fix')
WARNING: VerifyWarning: Verification reported errors: [astropy.io.fits.verify]
WARNING: VerifyWarning: HDU 0: [astropy.io.fits.verify]
WARNING: VerifyWarning:     Card 142: [astropy.io.fits.verify]
WARNING: VerifyWarning:         Card 'MODE' is not FITS standard (invalid value string: 'IFU / Reduction mode').  Fixed 'MODE' card to meet the FITS standard. [astropy.io.fits.verify]
WARNING: VerifyWarning: Note: astropy.io.fits uses zero-based indexing.
 [astropy.io.fits.verify]

>>> pf[0].header['MODE']
'IFU'

If this file was generated by an observatory, please also alert them to fix their pipeline. cc @orifox @camipacifici

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

No branches or pull requests

1 participant