Lightkurve v2.0
LightCurve.
flatten
Removes the low frequency trend using scipy’s Savitzky-Golay filter.
This method wraps scipy.signal.savgol_filter.
scipy.signal.savgol_filter
The length of the filter window (i.e. the number of coefficients). window_length must be a positive odd integer.
window_length
The order of the polynomial used to fit the samples. polyorder must be less than window_length.
polyorder
If True, the method will return a tuple of two elements (flattened_lc, trend_lc) where trend_lc is the removed trend.
True
If there are large gaps in time, flatten will split the flux into several sub-lightcurves and apply savgol_filter to each individually. A gap is defined as a period in time larger than break_tolerance times the median gap. To disable this feature, set break_tolerance to None.
savgol_filter
break_tolerance
Number of iterations to iteratively sigma clip and flatten. If more than one, will perform the flatten several times, removing outliers each time.
Number of sigma above which to remove outliers from the flatten
Boolean array to mask data with before flattening. Flux values where mask is True will not be used to flatten the data. An interpolated result will be provided for these points. Use this mask to remove data you want to preserve, e.g. transits.
Dictionary of arguments to be passed to scipy.signal.savgol_filter.
LightCurve
New light curve object with long-term trends removed.
return_trend
New light curve object containing the trend that was removed.