clean_edges_scatter

tessilator.lc_analysis.clean_edges_scatter(f, MAD_fac=2.0, len_sub_raw=11, num_data_fac=0.1)[source]

Remove highly-scattered data at the edges of each group.

Some groups have very scattered fluxes at the edges, presumably because the sensors are unstable before and after data downlinks. These can degrade the quality of the periodogram analysis, or even lead to an incorrect period.

The idea is to group the first “n_sub” datapoints, and calculate the median absolute deviation (MAD). If this local MAD value is greater (less) than “MAD_fac” times the MAD of the full lightcurve, then the flag at this point is 0 (1). The first and last “(n_sub-1)/2” in the lightcurve are given a constant value. If the first/last MAD comparison yield a “1” value, then we include the full group, including the datapoints replaced with constant values – i.e., no cleaning is necessary.

The value for n_sub is chosen as the minimum value of “len_sub_raw”, or num_data_fac*(the number of datapoints in the whole set).

Parameters:
fIterable

The set of normalised flux coordinates

MAD_facfloat, optional, default=2.

The threshold number of MAD values to allow.

len_sub_rawint, optional, default=11

The number of data points to be used in the local MAD value.

num_data_facfloat, optional, default=0.1

The factor to multiply the number of data points by.

Returns:
firstint

The start index for the data string.

lastint

The end index for the data string.