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
{{ message }}
Repository navigation
OSError: Empty or corrupt FITS file (HEADER) #5732
astropy.io.open()
>>> OSError: Empty or corrupt FITS file
in particular I'm loading some files .fits and I know that the headers have a not valid character TEMP = -64.000000 / Actual temperature (�C)
so I've tried with fitsio.read() and it works, but I don't like to use it.
I've tried with fits.open(path,ignore_missing_end=True)
but I still have the same problem.
Do you have any idea on how to get the data without header issue??
Thank you
Which version of Astropy are you using? Which Python version? What is the complete Python commands and traceback? What happens when you run fitscheck on the file?
mpc:~$ fitscheck data.fits /anaconda/lib/python3.5/site-packages/pyfits/hdu/hdulist.py:848: VerifyWarning: Error validating header for HDU #0 (note: PyFITS uses zero-based indexing). 'ascii' codec can't decode byte 0xb0 in position 1973: ordinal not in range(128) There may be extra bytes after the last HDU or the file is corrupted. (len(hdulist), indent(str(exc))), VerifyWarning) EXCEPTION 'data.fits' .. Empty or corrupt FITS file 1 errors
and the error 'ascii' codec can't decode byte 0xb0 in position 1973' is exacly the one reported before about the character
Thank you
Activity
pllim commentedon Jan 24, 2017
Which version of Astropy are you using? Which Python version? What is the complete Python commands and traceback? What happens when you run
fitscheckon the file?jacopovpsi commentedon Jan 24, 2017
Metadata-Version: 1.1
Name: astropy
Version: 1.2.1
and python 3.5.2
mpc:~$ fitscheck data.fits /anaconda/lib/python3.5/site-packages/pyfits/hdu/hdulist.py:848: VerifyWarning: Error validating header for HDU #0 (note: PyFITS uses zero-based indexing). 'ascii' codec can't decode byte 0xb0 in position 1973: ordinal not in range(128) There may be extra bytes after the last HDU or the file is corrupted. (len(hdulist), indent(str(exc))), VerifyWarning) EXCEPTION 'data.fits' .. Empty or corrupt FITS file 1 errorsand the error 'ascii' codec can't decode byte 0xb0 in position 1973' is exacly the one reported before about the character
Thank you
pllim commentedon Jan 24, 2017
Looks like a duplicate of #5093 . For now, either use Python 2 or fix the FITS header.
aburgasser commentedon May 6, 2017
I'm having this same problem with NIRC2 imaging data - can someone explain how to "fix the FITS header"
pllim commentedon May 6, 2017
A workaround is to open it (successfully) in Python 2, and then use
writeto()to write out a valid file for Python 3.saimn commentedon May 19, 2017
Should be fixed by #6084 (if not, please reopen).