Skip to content

Documentation for design_matrix

scatterbrain.designmatrix.design_matrix (ABC)

Base class to store design matrices. This is an abstract base class.

design_matrix objects have the following properties.

Attributes:

Name Type Description
name str

Name of the design matrix

prior_mu xp.ndarray, int or float

The prior mean of the design matrix components

prior_sigma xp.ndarray, int or float

The prior standard deviation of the design matrix components

sigma_f xp.ndarray

The weights for each pixel in the design matrix. Default is equal weights.

A xp.ndarray

The design matrix array.

sigma_w_inv xp.ndarray

Inverse covariance matrix of the design matrix

shape tuple

Shape of the design matrix

copy(self)

Create a deep copy of self

dot(self, other)

Takes the dot product of self with a vector.

fit_batch(self, flux_cube)

Fit a given cube of data

Parameters:

Name Type Description Default
flux np.ndarray

3D array of values, must be shape (N, self.shape[1]**0.5, self.shape[1]**0.5)

required

Returns:

Type Description
np.ndarray

2D array of weights, shape (N, self.shape[0])

fit_frame(self, flux)

Fit a given frame of data

Parameters:

Name Type Description Default
flux np.ndarray

2D array of values, must be shape (self.shape[1]**0.5, self.shape[1]**0.5)

required

Returns:

Type Description
np.ndarray

1D array of weights, shape self.shape[0], i.e. number of components

join(self, other)

Join two design matrices together, by stacking them horizontally.

update_sigma_f(self, sigma_f)

Update the sigma_f values with new ones.

scatterbrain.designmatrix.TESS_design_matrix (design_matrix)

design_matrix Class specifically for working with TESS. Note you can not initialize this class, it has no _build method.

This object hard codes certain values, for example that TESS images are 2048x2048 pixels.

Attributes:

Name Type Description
ccd int

CCD number

column None or xp.ndarray

The column numbers to evaluate the design matrix at. If None, uses all pixels.

row None or xp.ndarray

The column numbers to evaluate the design matrix at. If None, uses all pixels.

cutout_size int

Size of a "cutout" of images to use. Default is 2048. Use a smaller cut out to test functionality

bore_pixel tuple

Location of the pixel closest to the telescope boresight

name str

Name of the design matrix

prior_mu xp.ndarray, int or float

The prior mean of the design matrix components

prior_sigma xp.ndarray, int or float

The prior standard deviation of the design matrix components

sigma_f xp.ndarray

The weights for each pixel in the design matrix. Default is equal weights.

A xp.ndarray

The design matrix array.

sigma_w_inv xp.ndarray

Inverse covariance matrix of the design matrix

shape tuple

Shape of the design matrix

__init__(self, sigma_f=None, prior_sigma=None, prior_mu=None, ccd=3, column=None, row=None, name='TESS', cutout_size=2048) special

Create a TESS_design_matrix object. Note, you can not initialize this object as it has no _build method.

Parameters:

Name Type Description Default
sigma_f xp.ndarray

The weights for each pixel in the design matrix. Default is equal weights.

None
prior_sigma xp.ndarray, int or float

The prior standard deviation of the design matrix components

None
prior_mu xp.ndarray, int or float

The prior mean of the design matrix components

None
ccd int

CCD number

3
column None or xp.ndarray

The column numbers to evaluate the design matrix at. If None, uses all pixels.

None
row None or xp.ndarray

The column numbers to evaluate the design matrix at. If None, uses all pixels.

None
name str

Name for design matrix

'TESS'
cutout_size int

Size of a "cutout" of images to use. Default is 2048. Use a smaller cut out to test functionality

2048

scatterbrain.designmatrix.cartesian_design_matrix (TESS_design_matrix)

Design matrix for 2D Polynomial in cartesian space

__init__(self, sigma_f=None, prior_sigma=None, prior_mu=None, ccd=3, npoly=5, column=None, row=None, cutout_size=2048) special

Create a cartesian_design_matrix object.

Parameters:

Name Type Description Default
sigma_f xp.ndarray

The weights for each pixel in the design matrix. Default is equal weights.

None
prior_sigma xp.ndarray, int or float

The prior standard deviation of the design matrix components

None
prior_mu xp.ndarray, int or float

The prior mean of the design matrix components

None
ccd int

CCD number

3
npoly int

Order of polymomial to create.

5
column None or xp.ndarray

The column numbers to evaluate the design matrix at. If None, uses all pixels.

None
row None or xp.ndarray

The column numbers to evaluate the design matrix at. If None, uses all pixels.

None
name str

Name for design matrix

required
cutout_size int

Size of a "cutout" of images to use. Default is 2048. Use a smaller cut out to test functionality

2048

scatterbrain.designmatrix.radial_design_matrix (TESS_design_matrix)

Design matrix for creating a polynomial in radial dimension from boresight pixel

__init__(self, sigma_f=None, prior_sigma=None, prior_mu=None, ccd=3, npoly=10, column=None, row=None, cutout_size=2048) special

Create a radial_design_matrix object.

Parameters:

Name Type Description Default
sigma_f xp.ndarray

The weights for each pixel in the design matrix. Default is equal weights.

None
prior_sigma xp.ndarray, int or float

The prior standard deviation of the design matrix components

None
prior_mu xp.ndarray, int or float

The prior mean of the design matrix components

None
ccd int

CCD number

3
npoly int

Order of polymomial to create.

10
column None or xp.ndarray

The column numbers to evaluate the design matrix at. If None, uses all pixels.

None
row None or xp.ndarray

The column numbers to evaluate the design matrix at. If None, uses all pixels.

None
name str

Name for design matrix

required
cutout_size int

Size of a "cutout" of images to use. Default is 2048. Use a smaller cut out to test functionality

2048

scatterbrain.designmatrix.spline_design_matrix (TESS_design_matrix)

Design matrix for creating a 2D cartesian spline.

__init__(self, sigma_f=None, prior_sigma=None, prior_mu=None, ccd=3, nknots=40, degree=2, column=None, row=None, cutout_size=2048) special

Create a spline_design_matrix object.

Parameters:

Name Type Description Default
sigma_f xp.ndarray

The weights for each pixel in the design matrix. Default is equal weights.

None
prior_sigma xp.ndarray, int or float

The prior standard deviation of the design matrix components

None
prior_mu xp.ndarray, int or float

The prior mean of the design matrix components

None
ccd int

CCD number

3
nknots int

Number of knots to use

40
degree int

Degree of basis spline

2
column None or xp.ndarray

The column numbers to evaluate the design matrix at. If None, uses all pixels.

None
row None or xp.ndarray

The column numbers to evaluate the design matrix at. If None, uses all pixels.

None
name str

Name for design matrix

required
cutout_size int

Size of a "cutout" of images to use. Default is 2048. Use a smaller cut out to test functionality

2048

scatterbrain.designmatrix.spline_design_matrix (TESS_design_matrix)

Design matrix for creating a 2D cartesian spline.

__init__(self, sigma_f=None, prior_sigma=None, prior_mu=None, ccd=3, nknots=40, degree=2, column=None, row=None, cutout_size=2048) special

Create a spline_design_matrix object.

Parameters:

Name Type Description Default
sigma_f xp.ndarray

The weights for each pixel in the design matrix. Default is equal weights.

None
prior_sigma xp.ndarray, int or float

The prior standard deviation of the design matrix components

None
prior_mu xp.ndarray, int or float

The prior mean of the design matrix components

None
ccd int

CCD number

3
nknots int

Number of knots to use

40
degree int

Degree of basis spline

2
column None or xp.ndarray

The column numbers to evaluate the design matrix at. If None, uses all pixels.

None
row None or xp.ndarray

The column numbers to evaluate the design matrix at. If None, uses all pixels.

None
name str

Name for design matrix

required
cutout_size int

Size of a "cutout" of images to use. Default is 2048. Use a smaller cut out to test functionality

2048