You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
>>> from astropy.io import fits
>>> hdu = fits.open('frame-u-005314-1-0136.fits.bz2')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/astropy/io/fits/hdu/hdulist.py", line 129, in fitsopen
return HDUList.fromfile(name, mode, memmap, save_backup, cache, **kwargs)
File "/usr/local/lib/python2.7/site-packages/astropy/io/fits/hdu/hdulist.py", line 271, in fromfile
save_backup=save_backup, cache=cache, **kwargs)
File "/usr/local/lib/python2.7/site-packages/astropy/io/fits/hdu/hdulist.py", line 829, in _readfrom
hdu = _BaseHDU.readfrom(ffo, **kwargs)
File "/usr/local/lib/python2.7/site-packages/astropy/io/fits/hdu/base.py", line 378, in readfrom
**kwargs)
File "/usr/local/lib/python2.7/site-packages/astropy/io/fits/hdu/base.py", line 438, in _readfrom_internal
header = Header.fromfile(data, endcard=not ignore_missing_end)
File "/usr/local/lib/python2.7/site-packages/astropy/io/fits/header.py", line 460, in fromfile
padding)[1]
File "/usr/local/lib/python2.7/site-packages/astropy/io/fits/header.py", line 529, in _from_blocks
raise IOError('Header missing END card.')
IOError: Header missing END card.
After bunzip2
>>> hdu = fits.open('frame-u-005314-1-0136.fits')
works fine.
OS X 10.10.3, Python 2.7.9, Astropy 1.0.3, Numpy 1.9.2.
The version of Astropy you're using does not support transparent reading from bz2 files. This was only added very recently in the development version (#3789) and will be available in Astropy v1.1.0.
By the way, as a current workaround you can still Python's bz2 library and pass an open bz2 file in to fits.open(), which will generally work with any stream-like object:
Ah, but the message was in error! There was an 'end' card (I ran also
fverify on it and that gave no errors). [I assume you know the ftools]. It
is an error message that pops up when the file is compressed. Imho I think
fits.open should read the first few characters to see if this is a
compressed file. Actually, I'm kind of surprised, since the fits file
should start with "SIMPLE = T", but apparently that check gets passed (or
not done perhaps?). Anyway, sorry to add to your burden, but something can
be improved there with the error trapping.
Well, over there it must be about time to leave for the weekend, so let me
wish you a good one!
Activity
embray commentedon Jun 24, 2015
Hi @eddedmondson,
The version of Astropy you're using does not support transparent reading from bz2 files. This was only added very recently in the development version (#3789) and will be available in Astropy v1.1.0.
embray commentedon Jun 24, 2015
By the way, as a current workaround you can still Python's
bz2library and pass an open bz2 file in tofits.open(), which will generally work with any stream-like object:The only difference in the new version is that it can detect bz2 files automatically from the filename and/or contents and do this automatically.
PaulKuin commentedon Aug 21, 2015
I just had a similar problem with an ESO file that had been compressed (.Z) Error reported was "Header missing END card."
embray commentedon Aug 21, 2015
@PaulKuin Regarding "Header missing END card": #3941
PaulKuin commentedon Aug 21, 2015
Hi Erik,
Ah, but the message was in error! There was an 'end' card (I ran also
fverify on it and that gave no errors). [I assume you know the ftools]. It
is an error message that pops up when the file is compressed. Imho I think
fits.open should read the first few characters to see if this is a
compressed file. Actually, I'm kind of surprised, since the fits file
should start with "SIMPLE = T", but apparently that check gets passed (or
not done perhaps?). Anyway, sorry to add to your burden, but something can
be improved there with the error trapping.
Well, over there it must be about time to leave for the weekend, so let me
wish you a good one!
Paul
On Fri, Aug 21, 2015 at 7:33 PM, Erik Bray [email protected] wrote:
Dr. N.P.M. Kuin ([email protected])
phone +44-(0)1483 (prefix) -204927 (work)
mobile +44(0)7806985366 skype ID: npkuin
Mullard Space Science Laboratory – University College London –
Holmbury St Mary – Dorking – Surrey RH5 6NT– U.K.
embray commentedon Aug 21, 2015
Right, that's what was discussed in #3941.
embray commentedon Aug 21, 2015
And thanks, you have a good one too!