KeplerCBVCorrector

class lightkurve.correctors.KeplerCBVCorrector(lc, cbv_array=None, cbv_cadenceno=None, likelihood=<class 'oktopus.likelihood.LaplacianLikelihood'>, prior=<class 'oktopus.prior.LaplacianPrior'>)

Bases: lightkurve.correctors.corrector.Corrector

Remove systematic trends from Kepler light curves by fitting Cotrending Basis Vectors (CBVs).

\[\arg \min_{\bm{\theta} \in \Theta} \sum_{t}|f_{SAP}(t) - \sum_{j=1}^{n}\theta_j v_{j}(t)|^p, p>0, p \in \mathbb{R}\]

Examples

>>> import matplotlib.pyplot as plt
>>> from lightkurve import KeplerCBVCorrector, KeplerLightCurveFile
>>> fn = ("https://archive.stsci.edu/missions/kepler/lightcurves/"
...       "0084/008462852/kplr008462852-2011073133259_llc.fits") 
>>> cbv = KeplerCBVCorrector(fn) 
Downloading https://archive.stsci.edu/missions/kepler/lightcurves/0084/008462852/kplr008462852-2011073133259_llc.fits [Done]
>>> cbv_lc = cbv.correct() 
Downloading http://archive.stsci.edu/missions/kepler/cbv/kplr2011073133259-q08-d25_lcbv.fits [Done]
>>> sap_lc = KeplerLightCurveFile(fn).SAP_FLUX 
>>> plt.plot(sap_lc.time, sap_lc.flux, 'x', markersize=1, label='SAP_FLUX') 
>>> plt.plot(cbv_lc.time, cbv_lc.flux, 'o', markersize=1, label='CBV_FLUX') 
>>> plt.legend() 
Attributes
lcKeplerLightCurveFile, KeplerLightCurve object or str

An instance from KeplerLightCurveFile or a path for the .fits file of a NASA’s Kepler/K2 light curve.

likelihoodoktopus.Likelihood subclass

A class that describes a cost function. The default is oktopus.LaplacianLikelihood, which is tantamount to the L1 norm.

Attributes Summary

coeffs

Returns the fitted coefficients.

lc

opt_result

Returns the result of the optimization process.

Methods Summary

correct(self[, cbvs, method, options])

Correct the SAP_FLUX by fitting a number of cotrending basis vectors cbvs.

diagnose(self)

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

get_cbv_url(self)

get_cbvs_list(self)

Returns the subsequence of subsequent CBVs that maximizes Bayes’ factor [1].

plot_cbvs(self[, cbvs, ax])

Plot the CBVs for a given list of CBVs

Attributes Documentation

coeffs

Returns the fitted coefficients.

lc
opt_result

Returns the result of the optimization process.

Methods Documentation

correct(self, cbvs=(1, 2), method='powell', options=None)

Correct the SAP_FLUX by fitting a number of cotrending basis vectors cbvs.

Parameters
cbvslist of ints

The list of cotrending basis vectors to fit to the data. For example, [1, 2] will fit the first two basis vectors.

methodstr

Numerical optimization method. See scipy.optimize.minimize for the full list of methods.

optionsdict

Dictionary of options to be passed to scipy.optimize.minimize.

diagnose(self)

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

get_cbv_url(self)
get_cbvs_list(self)

Returns the subsequence of subsequent CBVs that maximizes Bayes’ factor [1].

Returns
cbv_listlist

Subsequence of subsequent CBVs that maximizes the Bayes’ factor.

References

1(1,2)

https://en.wikipedia.org/wiki/Bayes_factor

plot_cbvs(self, cbvs=(1, 2), ax=None)

Plot the CBVs for a given list of CBVs

Parameters
cbvslist of ints

The list of cotrending basis vectors to fit to the data. For example, [1, 2] will fit the first two basis vectors.

axmatplotlib.pyplot.Axes.AxesSubplot

Matplotlib axis object. If None, one will be generated.

Returns
axmatplotlib.pyplot.Axes.AxesSubplot

Matplotlib axis object