SFFCorrector

class lightkurve.correctors.SFFCorrector[source]

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

Methods Summary

arclength(x1, x) Compute the arclength of the polynomial used to fit the centroid measurements.
bin_and_interpolate(s, normflux, bins, sigma)
breakpoints(campaign) Return a break point as a function of the campaign number.
correct(time, flux, centroid_col, centroid_row) Returns a systematics-corrected LightCurve.
fit_bspline(time, flux[, knotspacing])
rotate_centroids(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.

Methods Documentation

arclength(x1, x)[source]

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

Parameters:
x1 : float

Upper limit of the integration domain.

x : ndarray

Domain at which the arclength integrand is defined.

Returns:
arclength : float

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

bin_and_interpolate(s, normflux, bins, sigma)[source]
breakpoints(campaign)[source]

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(time, flux, centroid_col, centroid_row, polyorder=5, niters=3, bins=15, windows=10, sigma_1=3.0, sigma_2=5.0, restore_trend=False)[source]

Returns a systematics-corrected LightCurve.

Note that it is assumed that time and flux do not contain NaNs.

Parameters:
time : array-like

Time measurements

flux : array-like

Data flux for every time point

centroid_col, centroid_row : array-like, array-like

Centroid column and row coordinates as a function of time

polyorder : int

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

niters : int

Number of iterations of the aforementioned algorithm.

bins : int

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

windows : int

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

sigma_1, sigma_2 : float, float

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

restore_trend : bool

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

Returns:
corrected_lightcurve : LightCurve object

Returns a corrected lightcurve object.

fit_bspline(time, flux, knotspacing=1.5)[source]
rotate_centroids(centroid_col, centroid_row)[source]

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.