KeplerCBVCorrector

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

Bases: object

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") # doctest: +SKIP
>>> cbv = KeplerCBVCorrector(fn) # doctest: +SKIP
Downloading https://archive.stsci.edu/missions/kepler/lightcurves/0084/008462852/kplr008462852-2011073133259_llc.fits [Done]
>>> cbv_lc = cbv.correct() # doctest: +SKIP
Downloading http://archive.stsci.edu/missions/kepler/cbv/kplr2011073133259-q08-d25_lcbv.fits [Done]
>>> sap_lc = KeplerLightCurveFile(fn).SAP_FLUX # doctest: +SKIP
>>> plt.plot(sap_lc.time, sap_lc.flux, 'x', markersize=1, label='SAP_FLUX') # doctest: +SKIP
>>> plt.plot(cbv_lc.time, cbv_lc.flux, 'o', markersize=1, label='CBV_FLUX') # doctest: +SKIP
>>> plt.legend() # doctest: +SKIP
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.

KeplerCBVCorrector.lc_file

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.

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.

opt_result

Returns the result of the optimization process.

Methods Documentation

correct(self, cbvs=[1, 2], method='powell', options={})

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.

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


Created with ♥ by the Lightkurve collaboration. Please cite us or join us on GitHub.