calibrate

sofia_redux.instruments.exes.calibrate.calibrate(data, header, flat, variance, flat_var=None)[source]

Calibrate spectral image to physical units.

Each frame in the input data cube is multiplied by the flat frame, which has been normalized by the black-body function. This has the effect of both correcting the science frame for instrumental response and calibrating it to intensity units.

Parameters:
datanumpy.ndarray

Data cube of shape [nframe, nspec, nspat] or image [nspec, nspat].

headerfits.Header

Header associated with the input data.

flatnumpy.ndarray

Flat image of shape [nspec, nspat].

variancenumpy.ndarray

Variance array matching data shape.

flat_varnumpy.ndarray, optional

Flat variance array of shape (nspec, nspat). If provided, it is propagated into the output variance.

Returns:
data, variancenumpy.ndarray, numpy.ndarray

The calibrated data and updated variance.