pyhdfits.py¶
Drop-in replacement for pyfits / astro.io.fits
. This provides an open() function
that opens either a FITS file, or a HDFITS file, and return a FITS object.
The idea here to replace:
>> from astropy.io import fits as pf
with the following import:
>> from fits2hdf import pyhdfits as pf
So that both HDF5 and FITS files can be read transparently.
-
fits2hdf.pyhdfits.
open
(*args, **kwargs)¶ Open a file, and return a FITS HDUList object.
This overrides the default pyfits open, and first checks to see if the file is a HDF5 file. If so, then the file is opened using fits2hdf.io.hdfio and then exported to a FITS file (in memory, not on disk).
If you’re not careful, this will override the standard open() class. So, never do “from pyhdfits import open”, as this would be bad. #TODO: Do this slightly different, to avoid the open() issue