lightkurve.correctors.RegressionCorrector

class lightkurve.correctors.RegressionCorrector(lc)[source]

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^{-1} = (X^\top \cov^{-1} X + \boldsymbol\sigma^{-2}_\w I)\]
Parameters
lcLightCurve

The light curve that needs to be corrected.

__init__(lc)[source]

Constructor method.

The constructor shall: * accept all data required to run the correction (e.g. light curves, target pixel files, engineering data). * instantiate the original_lc property.

Methods

__init__(lc)

Constructor method.

compute_overfit_metric(**kwargs)

Measures the degree of over-fitting in the correction.

compute_underfit_metric(**kwargs)

Measures the degree of under-fitting the correction.

correct(design_matrix_collection[, ...])

Find the best fit correction for the light curve.

diagnose()

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

diagnose_priors()

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

Attributes

cadence_mask

corrected_lc

dmc

Shorthand for self.design_matrix_collection.

original_lc