[AstroPy] Opening file in PyFits, works in v2.4, not in v3.0.6

Eddy Barratt eddybarratt1 at yahoo.co.uk
Mon Apr 2 20:09:44 EDT 2012


I have a number of fits files that I cannot open in PyFits 3.0.6, though a colleague using 2.4 can open them. PyFits does work on other fits files on my computer. I would have assumed that the problem is with the files, but they do open using the older version and my colleagues using IDL and matlab have managed to open them too, so perhaps the issue is with PyFits instead. I've attached one of the files, they all have the same error message.


Here is the error message:

>>> pyfits.open('00000064.DARK.fits')
Unexpected extra padding at the end of the file.  This padding may not be preserved when saving changes.
Error validating header for HDU #0 (note: PyFITS uses zero-based indexing).
    Header size is not multiple of 2880: 2560
There may be extra bytes after the last HDU or the file is corrupted.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyfits/util.py", line 206, in _with_extensions_wrapper
    return func(*args, **kwargs)
  File "/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyfits/hdu/hdulist.py", line 103, in fitsopen
    return HDUList.fromfile(name, mode, memmap, **kwargs)
  File "/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyfits/hdu/hdulist.py", line 275, in fromfile
    raise IOError('Empty or corrupt FITS file')
IOError: Empty or corrupt FITS file

I'm new to PyFits, I'd appreciate any guidance at all on this issue. I tried to attach the file to this e-mail but it seems that's not allowed, if anyone thinks they may be able to assist please let me know and I can e-mail the file.

Thanks. Eddy 



More information about the AstroPy mailing list