detrend_lc

tessilator.lc_analysis.detrend_lc(t, f, lc, MAD_fac=2.0, poly_max=3)[source]

Detrend and normalise the lightcurves.

This function runs 3 operations to detrend the lightcurve, as follows:
1. Choose whether a zeroth- or first-order polynomial is the best fit to the full light-curve, using AIC, and detrend the full lightcurve.
2. Decide whether to use the detrended lightcurve from part 1, or to detrend individual groups.
3. Return the detrended flux.
Parameters:
tIterable

the time component of the lightcurve

fIterable

the flux component of the lightcurve.

lcIterable

The index representing the lightcurve component. Note this must be indexed starting from 1.

MAD_facfloat, optional, default = 2.

The factor to multiply the median absolute deviation by.

poly_maxint, optional, default=8

The maximum order of the polynomial fit.

Returns:
f_normIterable

The corrected lightcurve after the detrending procedures.

detr_dictdict

A dictionary containing the parameters: norm_flag, smooth_flag, “f1_at_f2_0, f2_at_f2_0, f1_MAD, f2_MAD” (see norm_choice) and “s_fit, coeffs” (see aic_selector)