robust_read¶
- sofia_redux.toolkit.utilities.fits.robust_read(filename, data_hdu=0, header_hdu=0, extension=None, verbose=True)[source]¶
Retrieve the data and header from a FITS file
Does as many checks as possible to fix a potentially broken FITS file. Feel free to add other stuff.
- Parameters:
- filenamestr
path to a FITS file
- header_hduint, optional
Header Data Unit to retrieve header. Default is 0 (Primary)
- data_hduint, optional
Header Data Unit to retrieve data. Default is 0 (Primary)
- extensionint, optional
If supplied, overrides both
header_hdu
anddata_hdu
- verbosebool, optional
If True, output log messages on error
- Returns:
- numpy.ndarray, astropy.io.fits.header.Header
The data array and header of the FITS file as a 2-tuple