apply_tellcor

sofia_redux.calibration.pipecal_util.apply_tellcor(data, header, config, variance=None, covariance=None, use_wv=False)[source]

Apply a telluric correction factor to an image.

The image is corrected as:

corrected = flux * tel_factor

If provided, the variance and/or covariance are propagated as well, as:

corrected_variance = variance * tel_factor^2
corrected_covariance = covariance / tel_factor^2

The provided header is also updated with relevant keywords and a history message.

Parameters:
dataarray

Image to correct.

headerastropy.io.fits.header.Header

FITS header to update.

configdict-like

Calibration configuration values, as produced by pipecal.pipecal_config.pipecal_config.

variancearray, optional

Variance image to propagate, if desired.

covariancearray, optional

Covariance image to propagate, if desired.

use_wvbool, optional

If set, precipitable water vapor will be used as the reference value, instead of altitude.

Returns:
array, or 2- or 3-length tuple

If only data is provided, it is returned as an array. If variance is provided, the return value is (data, variance). If covariance is provided, the return value is (data, variance, covariance); if the variance was not provided, it will be set to None.

Raises:
PipeCalError

If no valid telluric correction factor is found.