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

Error in reading long header values via astropy.io.fits #1

Open
demitri opened this issue Aug 3, 2020 · 0 comments
Open

Error in reading long header values via astropy.io.fits #1

demitri opened this issue Aug 3, 2020 · 0 comments

Comments

@demitri
Copy link
Owner

demitri commented Aug 3, 2020

Example:

from astropy.io import fits
from cornish  import ASTFrameSet 
hdu_list = fits.open("MISDR1_24278_0266_0001-nd-cat_mch_flagstar.fits.gz")  
hdu1 = hdu_list[0] 
f = ASTFrameSet.fromFITSHeader(hdu1.header)

Trace:

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-7-1361cb9c9c83> in <module>
----> 1 f = ASTFrameSet.fromFITSHeader(hdu1.header)

~/Documents/Repositories/GitHub/cornish/cornish/mapping/frame/frame_set.py in fromFITSHeader(fits_header)
    101                 from ...channel import ASTFITSChannel # or "from cornish import ..." ?
    102 
--> 103                 fits_channel = ASTFITSChannel(header=fits_header)
    104 
    105                 # does this channel contain a frame set?

~/Documents/Repositories/GitHub/cornish/cornish/channel/fits_channel.py in __init__(self, ast_object, hdu, header)
     86                         if isinstance(header, (astropy.io.fits.header.Header, fitsio.fitslib.FITSHDR)) or \
     87                            (isinstance(header, list) and isinstance(header[0], str)):
---> 88                            self._readHeader()
     89                         elif isinstance(header, list):
     90                                 logger.debug("Found list header")

~/Documents/Repositories/GitHub/cornish/cornish/channel/fits_channel.py in _readHeader(self)
    120                         #self.fitsChan = Ast.FitsChan(source="".join([c.image for x in hdu.header.cards]))
    121                         for card in self.header.cards:
--> 122                                 self.addHeader(card=card)
    123 
    124                 # try to read the header from an fitsio header object

~/Documents/Repositories/GitHub/cornish/cornish/channel/fits_channel.py in addHeader(self, card, keyword, value, comment, overwrite)
    274 #                                       raise Exception("Not implemented: handle value of type '{0}'.".format(type(value)))
    275 
--> 276                 assert len(fits_header_card) <= 80, "The FITS card is incorrectly formatted (>80 char) or a bad value has been given: '{0}'".format(fits_header_card)
    277 
    278                 self.astObject.putfits(fits_header_card, overwrite)

AssertionError: The FITS card is incorrectly formatted (>80 char) or a bad value has been given: 'SEXCAT  = '/home/eisa2/fltops/pipe/01-vsn/03000-MISDR1_24278_0266/d/00-visits/&'CONTINUE  '0001-img/07-try/MISDR1_24278_0266_0001-nd-cat.fits'                  '
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