lincor

sofia_redux.instruments.flitecam.lincor.lincor(hdul, linfile, saturation=None)[source]

Correct input flux data for detector nonlinearity.

The image is corrected by multiplying it by the factor 1 / (1 + (a1/a0) * counts + … + (an/a0) * counts^n), where the a values are the coefficients given in the input linearity file and the counts are the values given in the input image.

The output flux is also divided by exposure time to convert from counts (ct) to flux units (ct/s).

Parameters:
hdulfits.HDUList

Input data. Should have a single primary FLUX extension.

linfilestr

Path to an input FITS file containing linearity coefficients. The file should contain a single primary image extension, with dimensions 1024 x 1024 x n, giving the correction coefficients for each pixel in the FLITECAM array.

saturationfloat, optional

If provided, values (as flux / divisor) above this level are marked as bad in the output BADMASK extension (0 = good, 1 = bad).

Returns:
fits.HDUList

Corrected data, with updated FLUX and additional ERROR and BADMASK extension.

Raises:
ValueError

If the linearity file is bad or missing.