KeplerCBVCorrector

class lightkurve.correctors.KeplerCBVCorrector(lc_file, 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:
lc_file : KeplerLightCurveFile object or str

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

likelihood : oktopus.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_file
opt_result Returns the result of the optimization process.

Methods Summary

correct([cbvs, method, options]) Correct the SAP_FLUX by fitting a number of cotrending basis vectors cbvs.
get_cbv_url()
get_cbvs_list() Returns the subsequence of subsequent CBVs that maximizes Bayes’ factor [1].
plot_cbvs([cbvs, ax]) Plot the CBVs for a given list of CBVs

Attributes Documentation

coeffs

Returns the fitted coefficients.

lc_file
opt_result

Returns the result of the optimization process.

Methods Documentation

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

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

Parameters:
cbvs : list of ints

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

method : str

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

options : dict

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

get_cbv_url()
get_cbvs_list()

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

Returns:
cbv_list : list

Subsequence of subsequent CBVs that maximizes the Bayes’ factor.

References

[1](1, 2, 3) https://en.wikipedia.org/wiki/Bayes_factor
plot_cbvs(cbvs=[1, 2], ax=None)

Plot the CBVs for a given list of CBVs

Parameters:
cbvs : list of ints

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

ax : matplotlib.pyplot.Axes.AxesSubplot

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

Returns:
ax : matplotlib.pyplot.Axes.AxesSubplot

Matplotlib axis object


Created with ♥ by the Lightkurve developers. Join us on GitHub.