- class lightkurve.correctors.CBVCorrector(lc, interpolate_cbvs=False, extrapolate_cbvs=False, do_not_load_cbvs=False, cbv_dir=None)#
Class for removing systematics using Cotrending Basis Vectors (CBVs) from Kepler/K2/TESS.
On construction of this object, the relevant CBVs will be downloaded from MAST appropriate for the lightcurve object passed to the constructor.
For TESS there are multiple CBV types. All are loaded and the user must specify which to use in the correction.
The light curve loaded into CBVCorrector in electrons / second
- cbvsCotrendingBasisVectors list
The retrieved CBVs, can contain multiple types of CBVs
If true then the CBVs have been interpolated to the lightcurve
The retrieved CBVs ported into a DesignMatrix object
An extra design matrix to include in the fit with the CBVs
The design matrix collection composed of cbv_design_matrix and extra_design_matrix
The returned light curve from correct() in electrons / second
- coefficientsfloat ndarray
The fit coefficients corresponding to the design_matrix_collection
- coefficients_errfloat ndarray
The error estimates for the coefficients, see regressioncorrector
The model fit to the lightcurve ‘lc’
Model fits for each of the sub design matrices fit in model_lc
SPOC SAP light curves of all targets within the defined neighborhood of the target under study for use with the under-fitting metric
- lc_neighborhood_fluxlist of arrays
Neighboring target flux aligned or interpolated to the target under study cadence
- cadence_masknp.ndarray of bool
Mask, where True indicates a cadence that was used in RegressionCorrector.correct. Note: The saved cadence_mask is overwritten for each call to correct().
Over-fitting score from the most recent run of correct()
Under-fitting score from the most recent run of correct()
L2-norm regularization term used in most recent fit Equivalent to: designmatrix prior sigma = np.median(self.lc.flux_err) / np.sqrt(alpha)
- __init__(lc, interpolate_cbvs=False, extrapolate_cbvs=False, do_not_load_cbvs=False, cbv_dir=None)#
This constructor will retrieve all relevant CBVs from MAST and then align or interpolate them with the passed-in light curve.
The light curve to correct
By default, the cbvs will be ‘aligned’ to the lightcurve. If you wish to interpolate the cbvs instead then set this to True. Uses Piecewise Cubic Hermite Interpolating Polynomial (PCHIP).
Set to True if the CBVs also have to be extrapolated outside their time stamp range. (If False then those cadences are filled with NaNs.)
If True then the CBVs will NOT be loaded from MAST. Use this option if you wish to use the CBV corrector methods with only a custom design matrix (via the ext_dm argument in the corrector methods)
Path to specific directory holding TESS CBVs. If this is None, will query MAST by default.
__init__(lc[, interpolate_cbvs, ...])
Measures the degree of over-fitting in the correction.
Measures the degree of under-fitting the correction.
Returns a copy of this
correct([cbv_type, cbv_indices, ext_dm, ...])
Optimizes the correction by adjusting the L2-Norm (Ridge Regression) regularization penalty term, alpha, based on the introduced noise (over-fitting) and residual correlation (under-fitting) goodness metrics.
correct_elasticnet([cbv_type, cbv_indices, ...])
Performs the correction using scikit-learn's ElasticNet which utilizes combined L1- and L2-Norm priors as a regularizer.
Performs the correction using RegressionCorrector methods.
Pass-through method to gain access to the superclass RegressionCorrector.correct() method.
Returns diagnostic plots to assess the most recent correction.
Returns a diagnostic plot visualizing how the best-fit coefficients compare against the priors.
Returns a diagnostic plot of the over and under goodness metrics as a function of the L2-Norm regularization term, alpha.
Computes the over-fitting metric using metrics.overfit_metric_lombscargle
under_fitting_metric([radius, min_targets, ...])
Computes the under-fitting metric using metrics.underfit_metric_neighbors
Shorthand for self.design_matrix_collection.