lightkurve.correctors.SparseDesignMatrix#
- class lightkurve.correctors.SparseDesignMatrix(X, columns=None, name='unnamed_matrix', prior_mu=None, prior_sigma=None)[source]#
A matrix of column vectors for use in linear regression.
This class is similar to the
DesignMatrixclass, but uses thescipy.sparselibrary to improve speed in the case of sparse matrices.The purpose of this class is to provide a convenient method to interact with a set of one or more regressors which are known to correlate with trends or systematic noise signals which we want to remove from a light curve. Specifically, this class is designed to provide the design matrix for use by Lightkurve’s
RegressionCorrectorclass.- Parameters
- X
scipy.sparsematrix The values to build the design matrix with
- columnsiterable of str (optional)
Column names
- namestr
Name of the matrix.
- prior_muarray
Prior means of the coefficients associated with each column in a linear regression problem.
- prior_sigmaarray
Prior standard deviations of the coefficients associated with each column in a linear regression problem.
- X
Methods
__init__(X[, columns, name, prior_mu, ...])append_constant([prior_mu, prior_sigma, inplace])Returns a new
SparseDesignMatrixwith a column of ones appended.collect(matrix)Join two designmatrices, return a design matrix collection
copy()Returns a deepcopy of DesignMatrix
pca([nterms])Returns a new
SparseDesignMatrixwith a smaller number of regressors.plot([ax])Visualize the design matrix values as an image.
plot_priors([ax])Visualize the coefficient priors.
split(row_indices[, inplace])Returns a new
SparseDesignMatrixwith regressors split into multiple columns.standardize([inplace])Returns a new
SparseDesignMatrixin which the columns have been mean-subtracted and sigma-divided.to_dense()Convert a SparseDesignMatrix object to a dense DesignMatrix
to_sparse()Convert this dense matrix object to a
SparseDesignMatrix.validate([rank])Checks if the matrix has the right shapes.
Attributes
XDesign matrix "X" to be used in RegressionCorrector objects
rankMatrix rank computed using
numpy.linalg.matrix_rank.shapeTuple specifying the shape of the matrix as (n_rows, n_columns).
values2D numpy array containing the matrix values.