Cotrending Basis Vectors (corrections.CBV
)
- class corrections.CBV(filepath)[source]
Bases:
object
Cotrending Basis Vector object.
- sector
TESS Sector.
- Type:
int
- cadence
TESS observing cadence in seconds.
- Type:
int
- camera
TESS Camera (1-4).
- Type:
int
- ccd
TESS CCD (1-4).
- Type:
int
- cbv_area
- Type:
int
- data_rel
TESS Data release number.
- Type:
int
- version
TASOC version/data release number.
- Type:
int
- filepath
Path to file where CVB is stored.
- Type:
str
- time
- Type:
numpy.ndarray
- cadenceno
- Type:
numpy.ndarray
- cbv
- Type:
numpy.ndarray
- cbv_s
- Type:
numpy.ndarray
- inifit
- Type:
numpy.ndarray
- priors
Code author: Mikkel N. Lund <mikkelnl@phys.au.dk>
Code author: Rasmus Handberg <rasmush@phys.au.dk>
- fit(lc, use_bic=True, use_prior=False, cbvs=None, alpha=1.3, WS_lim=0.5, N_neigh=1000)[source]
Fit the CBV object to a lightcurve, and return the fitted cotrending-lightcurve and the fitting coefficients.
- Parameters:
lc (
LightCurve
) – Lightcurve to be cotrended.use_bic (bool, optional) – Use the Bayesian Information Criterion to find the optimal number of CBVs to fit. Default=True.
use_prior (bool, optional)
cbvs (int, optional) – Number of CBVs to fit to lightcurve. If use_bic=True, this indicated the maximum number of CBVs to fit.
- Returns:
Fitted lightcurve with the same length as lc. - list: Coefficients for each CBV. - dict: Diagnostics information about the fitting.
- Return type:
numpy.array
- lsfit(lc, Ncbvs)[source]
Computes the weighted least-squares solution to a linear matrix equation.
- Parameters:
lc (
LightCurve
) – Lightcurve to fit.Ncbvs (int) – Number of CBVs to include in fit.
- Returns:
Coefficients for CBV plus constant offset.
- Return type:
ndarray
- mdl(coeffs)[source]
Model lightcurve given CBV coefficients.
- Parameters:
coeffs (ndarray) – CBV coefficients and constant offset. Should be of length 2*N+1, where the first N coefficients are for the CBVs, the next N are for the Spike-CBVs, and the last element is a constant offset.
- Returns:
- Model lightcurve, given the CBV coefficients provided. Will be in relative
flux around 1.
- Return type:
ndarray
- negloglike(coeffs, lc)[source]
Negative log-likelihood function.
- Parameters:
coeffs (ndarray) – CBV coefficients.
lc (
LightCurve
) – Lightcurve to be fitted. Should be in relative flux around 1.
- Returns:
The negative log-likelihood of the coefficients, given the lightcurve.
- Return type:
float
- save_to_fits(output_folder, version=6)[source]
Save CBVs to FITS file.
- Parameters:
output_folder (str) – Path to directory where FITS file should be saved.
version (int) – Data release number to add to file header.
- Returns:
Path to the generated FITS file.
- Return type:
str
- Raises:
FileNotFoundError – If output_folder is invalid.
Code author: Rasmus Handberg <rasmush@phys.au.dk>
Code author: Nicholas Saunders <nksaun@hawaii.edu>