RegressionCorrector¶

class
lightkurve.correctors.
RegressionCorrector
(lc)¶ Bases:
lightkurve.correctors.corrector.Corrector
Remove noise using linear regression against a
DesignMatrix
.\[\newcommand{\y}{\mathbf{y}} \newcommand{\cov}{\boldsymbol\Sigma_\y} \newcommand{\w}{\mathbf{w}} \newcommand{\covw}{\boldsymbol\Sigma_\w} \newcommand{\muw}{\boldsymbol\mu_\w} \newcommand{\sigw}{\boldsymbol\sigma_\w} \newcommand{\varw}{\boldsymbol\sigma^2_\w}\]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
 lc
LightCurve
The light curve that needs to be corrected.
 lc
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()
.diagnose_priors
(self)Returns a diagnostic plot visualizing how the bestfit 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
DesignMatrix
orDesignMatrixCollection
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.
 cadence_masknp.ndarray of bools (optional)
Mask, where True indicates a cadence that should be used.
 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.
 design_matrix_collection
 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, aValueError
will be raised. Returns
Axes
The matplotlib axes object.

diagnose_priors
(self)¶ Returns a diagnostic plot visualizing how the bestfit coefficients compare against the priors.
The method will show the results obtained during the most recent call to
correct()
. Ifcorrect()
has not yet been called, aValueError
will be raised. Returns
Axes
The matplotlib axes object.