backsub

sofia_redux.instruments.flitecam.backsub.backsub(hdul, bgfile=None, method='flatnorm')[source]

Correct flux data for background level.

To correct pixels individually, a background image must be provided with a FLUX extension and (optionally) an ERROR extension. The error is propagated assuming that the input data is independent of the sky data. Delete the extension or set the error plane to zero-values to skip error propagation.

Otherwise, a single background level can be determined from the median of each image, or from a header value derived from a sky flat file, stored in the FLATNORM keyword in the primary header of the input data. In this case, no error is propagated.

Parameters:
hdulfits.HDUList

Input data. Should have FLUX, ERROR, FLAT, and FLAT_ERROR extensions.

bgfilefits.HDUList, optional

Background image. Should have FLUX and ERROR extensions.

method{‘flatnorm’, ‘median’}, optional

Method for background value determination, if background image is not provided. If ‘flatnorm’, the header keyword FLATNORM will be subtracted from the data. If ‘median’, the image median will be subtracted from the data. Ignored if bgfile is not None.

Returns:
fits.HDUList

Corrected data, with updated FLUX and ERROR extensions.