submean

sofia_redux.instruments.exes.submean.submean(data, header, flat, illum, order_mask)[source]

Subtract residual sky background from nod-on-slit data by removing the mean value at each wavelength.

For each input frame, the mean value at each spectral column is calculated, using the flat to weight the values, then is subtracted from the data in the column. Input data is assumed to be distortion corrected and rotated to align the spectral axis with the x-axis.

Parameters:
datanumpy.ndarray

3D data cube [nframe, nspec, nspat]

headerfits.Header

FITS header associated with the data.

flatnumpy.ndarray

2D processed flat [nspec, nspat], as produced by exes.makeflat.

illumnumpy.ndarray

2D array [nspec, nspat] indicating illuminated regions of the frame. 1=illuminated, 0=unilluminated, -1=pixel that does not correspond to any region in the raw frame.

order_masknumpy.ndarray

2D array [nspat,nspec] indicating the order number for every pixel in the image. For pixels outsize illuminated orders, the value in the order_mask is NaN.

Returns:
corrected: numpy.ndarray

Returns the corrected 3D data cube [nspat,nspec,nframe].