How does one open a compressed fits file with pyfits?
The code below reads in the primary hdu, which is an image. The result is a NoneType object.
# read in file
file_input_fit = "myfile.fits.fz"
hdulist = pyfits.open(file_input_fit)
img = hdulist[0].data
Usage of keyword in pyfits.open() "disable_image_compression=True" appears ineffective.
If the
.data
attribute on the primary HDU isNone
that means the primary HDU contains no data. You can confirm this by checking the file info:Chances are you're trying to read a multi-extension FITS file, and the data you're looking for is in another castle, I mean, HDU.
disable_image_compression=True
wouldn't help since that disables support for compressed images :)ETA: In fact, a tile-compressed FITS image can never be in the primary HDU, since it's stored internally as a binary table, which can only be an extension HDU.