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 DesignMatrix class, but uses the scipy.sparse library 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 RegressionCorrector class.

Parameters
Xscipy.sparse matrix

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.

__init__(X, columns=None, name='unnamed_matrix', prior_mu=None, prior_sigma=None)[source]#

Methods

__init__(X[, columns, name, prior_mu, ...])

append_constant([prior_mu, prior_sigma, inplace])

Returns a new SparseDesignMatrix with 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 SparseDesignMatrix with 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 SparseDesignMatrix with regressors split into multiple columns.

standardize([inplace])

Returns a new SparseDesignMatrix in 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

X

Design matrix "X" to be used in RegressionCorrector objects

rank

Matrix rank computed using numpy.linalg.matrix_rank.

shape

Tuple specifying the shape of the matrix as (n_rows, n_columns).

values

2D numpy array containing the matrix values.