readfits

sofia_redux.instruments.forcast.readfits.readfits(filename, update_header=None, key=None, variance=False, stddev=False, fitshead=False, fitshdul=False, comment=None, hdu=0)[source]

Returns the array from the input file

Reads and returns the image array from a specified FITS file. If an input header is specified, it updates it with the filename or ID of the newly created read file (via addparent).

Parameters:
filenamestr

file path of the file to be read

update_headerastropy.io.fits.header.Header, optional

Header to update with a PARENTn keyword containing the file or ID of the new read file.

keystr, optional

If provided along with header, the ID of filename added to the PARENTn keyword in the header is also added under this keyword.

variancebool, optional

If True, the variance associated with the input FITS file will be calculated and returned by appending an additional dimension to the output array i.e., (2, …). If fitshdul is True, the variance will be stored in a separate extension instead.

stddevbool, optional

If True, the variance will be calculated, but its square root will be returned, as a standard deviation value, in place of the variance.

fitsheadbool, optional

if True, the output returned will be a 2-tuple where the first element is the data array, and the second will be the FITS header read from the file.

fitshdulbool, optional

if True, the output returned will be an astropy HDUList. Takes precedence over the fitshead key.

commentstr, optional

If set, will add a comment to key in the header

hduint, optional

Header Data Unit. Default is 0 (primary)

Returns:
numpy.ndarray, (numpy.ndarray, astropy.io.fits.header.Header),
or astropy.io.fits.HDUList

Image array or (Image array, header) if fitshead=True or astropy HDUList if fitshdul=True.