norm_choice

tessilator.lc_analysis.norm_choice(t_orig, f_orig, lc_part, MAD_fac=2.0, poly_max=4)[source]

Choose whether to detrend the lightcurve as one by individual groups.

There are always at least two data components in a TESS sector because of the finite time needed for data retrieval. This can sometimes lead to discontinuities between components because of TESS systematics and the temperature gradients across the photometer. These discontinuities can cause the phase of the sinusoidal fit to change, leading to low power output in the periodograms. Alternatively, if the data are all detrended individually, but the data is relatively continuous, this can lead to shorter period measurements.

The idea with this function is that a polynomial fit is made to each component (chosen using the Aikaike Information Criterion, AIC). The extrapolated flux value from component 1 is calculated at the point where component 2 starts. If the difference between this value and the actual normalised flux at this point is greater than a given threshold, the data should be detrended separately. Otherwise the full lightcurve can be detrended as a whole.

In addition, if the “smooth” flag (calculated from the “smooth_test” function) is True, then the lightcurve is detrended as a whole, regardless of the outcome from this function.

Parameters:
t_origIterable

The time coordinate

f_origIterable

The original, normalised flux values

lc_partIterable

The running index for each contiguous data section in the lightcurve

MAD_facfloat, optional, default=2.

The factor which is to be multiplied by the median absolute deviation.

poly_maxfloat, optional, default=4

The maximum polynomial order to test for the AIC evaluation.

Returns:
norm_flagbool

Determines whether the data should be detrended as one whole component (False) or by individual groups (True, providing the smooth flag is False).

smooth_flagbool

Determines whether any detrending should be performed by testing how smooth the lightcurve is.

f1_at_f2_0list

The extrapolated fluxes from group 1, calculated at the start point of group 2.

f2_at_f2_0list

The first flux values from group 2

f1_MADlist

The MAD fluxes from group 1

f2_MADlist

The MAD fluxes from group 2