detrend_lc

tessilator.lc_analysis.detrend_lc(ds, df, t, m, f, err, MAD_fac=2.0, poly_max=8)[source]

Detrend and normalise the lightcurves.

This function runs several operations to detrend the lightcurve, as follows:
1. Remove any sparse components of the lightcurve that will not benefit the lightcurve analysis.
2. Remove data points that are clearly outliers.
3. Choose the best detrending polynomial using the Aikaike Information Criterion, and detrend the full lightcurve.
4. Decide whether to use the detrended lightcurve from part 3, or to separate the lightcurve into individual components and detrend each one separately.
5. Place the results into a dictionary.
Parameters:
dsIterable

the start indices for the lightcurve.

dfIterable

the end indices for the lightcurve.

tIterable

The list of time coordinates.

mIterable

The list of magnitude coordinates.

fIterable

The list of flux coordinates.

errIterable

The list of flux error coordinates.

MAD_facfloat, optional, default = 2.0

The factor to multiply the median absolute deviation by.

poly_maxint, optional, default=8

The maximum order of the polynomial fit.

Returns:
dict_lcdict
A dictionary containing the following keys:
“time” -> The time coordinate
“mag” -> The magnitude coordinate
“oflux” -> The original, normalised flux values
“nflux” -> The detrended, cleaned, normalised flux values
“enflux” -> The error on “nflux”
“polyord” -> The polynomial order used for each detrend