Lightkurve v2.0
CBVCorrector.
correct
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. The numercial optimization is performed using the scipy.optimize.minimize_scalar Brent’s method.
The optimizer attempts to maximize the over- and under-fitting goodness metrics. However, once the target_over_score or target_under_score is reached, a “Leaky ReLU” is used so that the optimization “pressure” concentrates on the other metric until both metrics rise above their respective target scores, instead of driving a single metric to near 1.0.
The optimization parameters used are stored in self.optimization_params as a record of how the optimization was performed.
The optimized correction is performed using LightKurve’s RegressionCorrector methods. See correct_gaussian_prior for details.
List of CBV types to use in correction {‘ALL’ => Use all}
List of CBV vectors to use in each of cbv_type passed. {‘ALL’ => Use all} NOTE: 1-Based indexing!
DesignMatrix
DesignMatrixCollection
Optionally pass an extra design matrix to also be used in the fit
Mask, where True indicates a cadence that should be used.
upper anbd lowe bounds for alpha
Target Over-fitting metric score
Target under-fitting metric score
Maximum number of iterations to optimize goodness metrics
LightCurve
Corrected light curve, with noise removed. In units of electrons / second
Examples
The following example will perform the correction using the SingleScale and Spike basis vectors. It will use alpha bounds of [1.0,1e3]. The target over-fitting score is 0.5 and the target under-fitting score is 0.8.
>>> cbv_type = ['SingleScale', 'Spike'] >>> cbv_indices = [np.arange(1,9), 'ALL'] >>> cbvCorrector.correct(cbv_type=cbv_type, cbv_indices=cbv_indices, >>> alpha_bounds=[1.0,1e3], >>> target_over_score=0.5, target_under_score=0.8)