Correcting systematics#

Telescope data is always affected by noise contributed by the instrument. The lightkurve.correctors sub-package provides classes which offer different strategies to remove such noise. At the core of the package lies the generic RegressionCorrector class. It uses linear regression to correlate a light curve against a DesignMatrix of column vectors which are known to correlate with additive noise components.

The CBVCorrector, PLDCorrector, and SFFCorrector classes extend RegressionCorrector by providing the user with pre-configured DesignMatrix objects which are known to be effective at removing different types of noise.

Cotrending Basis Vectors (CBV)#

load_tess_cbvs([cbv_dir, sector, camera, ...])

Loads TESS cotrending basis vectors, either from a directory of CBV files already saved locally if cbv_dir is passed, or else will retrieve the relevant files programmatically from MAST.

load_kepler_cbvs([cbv_dir, mission, ...])

Loads Kepler or K2 cotrending basis vectors, either from a local directory cbv_dir or searches the public data archive at MAST <https://archive.stsci.edu>.

CBVCorrector(lc[, interpolate_cbvs, ...])

Class for removing systematics using Cotrending Basis Vectors (CBVs) from Kepler/K2/TESS.

CBVCorrector.correct([cbv_type, ...])

Optimizes the correction by adjusting the L2-Norm (Ridge Regression) regularization penalty term, alpha, based on the introduced noise (over-fitting) and residual correlation (under-fitting) goodness metrics.

CBVCorrector.diagnose()

Returns diagnostic plots to assess the most recent correction.

Pixel Level Decorrelation (PLD)#

PLDCorrector(tpf[, aperture_mask])

Implements the Pixel Level Decorrelation (PLD) systematics removal method.

PLDCorrector.correct([pld_order, ...])

Returns a systematics-corrected light curve.

PLDCorrector.diagnose()

Returns diagnostic plots to assess the most recent call to correct().

PLDCorrector.diagnose_masks()

Show different aperture masks used by PLD in the most recent call to correct().

Self Flat Fielding (SFF)#

SFFCorrector(lc)

Special case of RegressionCorrector where the DesignMatrix includes the target's centroid positions.

SFFCorrector.correct([centroid_col, ...])

Find the best fit correction for the light curve.

SFFCorrector.diagnose()

Returns a diagnostic plot which visualizes what happened during the most recent call to correct().

SFFCorrector.diagnose_arclength()

Returns a diagnostic plot which visualizes arclength vs flux from most recent call to correct().

Regression Corrector#

RegressionCorrector(lc)

Remove noise using linear regression against a DesignMatrix.

RegressionCorrector.correct(...[, ...])

Find the best fit correction for the light curve.

RegressionCorrector.diagnose()

Returns diagnostic plots to assess the most recent call to correct().

Creating a design matrix#

DesignMatrix(df[, columns, name, prior_mu, ...])

A matrix of column vectors for use in linear regression.

DesignMatrixCollection(matrices)

Object which stores multiple design matrices.

SparseDesignMatrix(X[, columns, name, ...])

A matrix of column vectors for use in linear regression.

SparseDesignMatrixCollection(matrices)

A set of design matrices.

A DesignMatrix has the following attributes:

DesignMatrix.X

Design matrix "X" to be used in RegressionCorrector objects

DesignMatrix.rank

Matrix rank computed using numpy.linalg.matrix_rank.

DesignMatrix.shape

Tuple specifying the shape of the matrix as (n_rows, n_columns).

DesignMatrix.values

2D numpy array containing the matrix values.

A DesignMatrix supports the following operations:

DesignMatrix.append_constant([prior_mu, ...])

Returns a new DesignMatrix with a column of ones appended.

DesignMatrix.collect(matrix)

Join two designmatrices, return a design matrix collection

DesignMatrix.copy()

Returns a deepcopy of DesignMatrix

DesignMatrix.pca([nterms, n_iter])

Returns a new DesignMatrix with a smaller number of regressors.

DesignMatrix.plot([ax])

Visualize the design matrix values as an image.

DesignMatrix.plot_priors([ax])

Visualize the coefficient priors.

DesignMatrix.split(row_indices[, inplace])

Returns a new DesignMatrix with regressors split into multiple columns.

DesignMatrix.standardize([inplace])

Returns a new DesignMatrix in which the columns have been median-subtracted and sigma-divided.

DesignMatrix.to_sparse()

Convert this dense matrix object to a SparseDesignMatrix.

DesignMatrix.validate([rank])

Emits LightkurveWarning if matrix has low rank or priors have incorrect shape.

corrector.Corrector(original_lc)

Abstract base class documenting the required structure of classes designed to remove systematic noise from light curves.

corrector.Corrector.correct([cadence_mask, ...])

Returns a LightCurve from which systematic noise has been removed.

corrector.Corrector.diagnose()

Returns plots which elucidate the most recent call to correct().