fit_1d_background_complex

jwst.residual_fringe.utils.fit_1d_background_complex(flux, weights, wavenum, ffreq=None, channel=1)[source]

Fit the background signal using a piecewise spline.

Note that this will also try to identify obvious emission lines and flag them, so they aren’t considered in the fitting.

Parameters:
fluxndarray

1D array of fluxes.

weightsndarray

1D array of weights.

wavenumndarray

1D array of wavenumbers.

ffreqfloat, optional

The expected fringe frequency, used to determine number of knots. If None, defaults to NUM_KNOTS constant.

channelint, optional

The channel to process. Used to determine if other arrays need to be reversed given the direction of increasing wavelength down the detector in MIRIFULONG.

Returns:
bg_fitndarray

The fitted background.

bgindxndarray

The location of the knots.