# SFFCorrector¶

class lightkurve.correctors.SFFCorrector(lightcurve)

Bases: object

Implements the Self-Flat-Fielding (SFF) systematics removal method.

This method is described in detail by Vanderburg and Johnson (2014). Briefly, the algorithm implemented in this class can be described as follows

1. Rotate the centroid measurements onto the subspace spanned by the eigenvectors of the centroid covariance matrix

2. Fit a polynomial to the rotated centroids

3. Compute the arclength of such polynomial

4. Fit a BSpline of the raw flux as a function of time

5. Normalize the raw flux by the fitted BSpline computed in step (4)

6. Bin and interpolate the normalized flux as a function of the arclength

7. Divide the raw flux by the piecewise linear interpolation done in step (6)

8. Set raw flux as the flux computed in step (7) and repeat

9. Multiply back the fitted BSpline

Parameters
lightcurveLightCurve

The light curve object on which the SFF algorithm will be applied.

Examples

>>> lc = LightCurve(time, flux)   # doctest: +SKIP
>>> corrector = SFFCorrector(lc)   # doctest: +SKIP
>>> new_lc = corrector.correct(centroid_col, centroid_row)   # doctest: +SKIP


Methods Summary

 arclength(self, x1, x) Compute the arclength of the polynomial used to fit the centroid measurements. bin_and_interpolate(self, s, normflux, bins, …) breakpoints(self, campaign) Return a break point as a function of the campaign number. correct(self[, centroid_col, centroid_row, …]) Returns a systematics-corrected LightCurve. fit_bspline(self, time, flux[, knotspacing]) Returns a scipy.interpolate.BSpline object to interpolate flux as a function of time. rotate_centroids(self, centroid_col, …) Rotate the coordinate frame of the (col, row) centroids to a new (x,y) frame in which the dominant motion of the spacecraft is aligned with the x axis.

Methods Documentation

arclength(self, x1, x)

Compute the arclength of the polynomial used to fit the centroid measurements.

Parameters
x1float

Upper limit of the integration domain.

xndarray

Domain at which the arclength integrand is defined.

Returns
arclengthfloat

Result of the arclength integral from x[0] to x1.

bin_and_interpolate(self, s, normflux, bins, sigma)
breakpoints(self, campaign)

Return a break point as a function of the campaign number.

The intention of this function is to implement a smart way to determine the boundaries of the windows on which the SFF algorithm is applied independently. However, this is not implemented yet in this version.

correct(self, centroid_col=None, centroid_row=None, polyorder=5, niters=3, bins=15, windows=10, sigma_1=3.0, sigma_2=5.0, restore_trend=False)

Returns a systematics-corrected LightCurve.

Parameters
centroid_col, centroid_rowarray-like, array-like

Centroid column and row coordinates as a function of time. If None, then the centroid_col and centroid_row attributes of the LightCurve passed to the constructor of this class will be used, if present.

polyorderint

Degree of the polynomial which will be used to fit one centroid as a function of the other.

nitersint

Number of iterations of the aforementioned algorithm.

binsint

Number of bins to be used in step (6) to create the piece-wise interpolation of arclength vs flux correction.

windowsint

Number of windows to subdivide the data. The SFF algorithm is ran independently in each window.

sigma_1, sigma_2float, float

Sigma values which will be used to reject outliers in steps (6) and (2), respectivelly.

restore_trendbool

If True, the long-term trend will be added back into the lightcurve.

Returns
corrected_lightcurveLightCurve

Returns a corrected light curve.

fit_bspline(self, time, flux, knotspacing=1.5)

Returns a scipy.interpolate.BSpline object to interpolate flux as a function of time.

rotate_centroids(self, centroid_col, centroid_row)

Rotate the coordinate frame of the (col, row) centroids to a new (x,y) frame in which the dominant motion of the spacecraft is aligned with the x axis. This makes it easier to fit a characteristic polynomial that describes the motion.