RegressionCorrector¶

class lightkurve.correctors.RegressionCorrector(lc)

Bases: lightkurve.correctors.corrector.Corrector

Remove noise using linear regression against a DesignMatrix.


Given a column vector of data $$\y$$ and a design matrix of regressors $$X$$, we will find the vector of coefficients $$\w$$ such that:

$\mathbf{y} = X\mathbf{w} + \mathrm{noise}$

We will assume that the model fits the data within Gaussian uncertainties:

$p(\y | \w) = \mathcal{N}(X\w, \cov)$

We make the regression robust by placing Gaussian priors on $$\w$$:

$p(\w) = \mathcal{N}(\muw, \sigw)$

We can then find the maximum likelihood solution of the posterior distribution $$p(\w | \y) \propto p(\y | \w) p(\w)$$ by solving the matrix equation:

$\w = \covw (X^\top \cov^{-1} \y + \boldsymbol\sigma^{-2}_\w I \muw)$

Where $$\covw$$ is the covariance matrix of the coefficients:

$\covw = (X^\top \cov^{-1} X + \boldsymbol\sigma^{-2}_\w I)^{-1}$
Parameters
lcLightCurve

The light curve that needs to be corrected.

Methods Summary

 correct(self, design_matrix_collection[, …]) Find the best fit correction for the light curve. diagnose(self) Returns diagnostic plots to assess the most recent call to correct(). Returns a diagnostic plot visualizing how the best-fit coefficients compare against the priors.

Methods Documentation

correct(self, design_matrix_collection, cadence_mask=None, sigma=5, niters=5, propagate_errors=False)

Find the best fit correction for the light curve.

Parameters
design_matrix_collection

One or more design matrices. Each matrix must have a shape of (time, regressors). The columns contained in each matrix must be known to correlate with additive noise components we want to remove from the light curve.

sigmaint (default 5)

Standard deviation at which to remove outliers from fitting

nitersint (default 5)

Number of iterations to fit and remove outliers

propagate_errorsbool (default False)

Whether to propagate the uncertainties from the regression. Default is False. Setting to True will increase run time, but will sample from multivariate normal distribution of weights.

Returns
LightCurve

Corrected light curve, with noise removed.

diagnose(self)

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

If correct() has not yet been called, a ValueError will be raised.

Returns
Axes

The matplotlib axes object.

diagnose_priors(self)

Returns a diagnostic plot visualizing how the best-fit coefficients compare against the priors.

The method will show the results obtained during the most recent call to correct(). If correct() has not yet been called, a ValueError will be raised.

Returns
Axes

The matplotlib axes object.