1. CovarianceMatrix#

class CovarianceMatrix(row_list: list[list], epoch: int, frame: str = 'J2000', from_list: bool = False, corr_factors: list | None = None, sequence_added_sigmas: list[ArrayWUnits] | None = None, definition=None)#

Bases: UncertaintyQuantification

Represents a covariance matrix for uncertainty quantification.

Provides methods to manipulate and perform operations on covariance matrices with support for units, correlation factors, and sequence scenarios.

Parameters:
  • row_list (list[list]) – Matrix data as a list of lists or diagonal elements for construction.

  • epoch (int) – The epoch of the covariance matrix.

  • frame (str, optional) – The reference frame of the covariance matrix. Defaults to ‘J2000’.

  • from_list (bool, optional) – If True, constructs matrix from diagonal elements. Defaults to False.

  • corr_factors (list, optional) – Correlation factors for off-diagonal elements. Defaults to None.

  • sequence_added_sigmas (list[ArrayWUnits], optional) – Additional standard deviations for sequence scenarios. Defaults to None.

  • definition (optional) – Sequence or state definition. Defaults to None.

Raises:

ValueError – If sequence_added_sigmas elements are not ArrayWUnits objects.

Attributes

definition

The sequence or state definition.

epoch

The epoch of the uncertainty representation.

frame

The reference frame of the uncertainty representation.

matrix

The covariance matrix as a list of lists.

Methods

covariance_matrix_from_list(sigmas, corr_matrix)

DEPRECATED: Use _build_from_diagonal instead.

get_standard_deviations()

Get standard deviations from the diagonal of the covariance matrix.

matrix_without_units()

Extract values from the covariance matrix without units.

reinitialize_with_matrix(new_matrix[, ...])

Create a new CovarianceMatrix instance with updated matrix values.

to_array()

Convert covariance matrix to numpy array without units.

vector_to_correlation_matrix(diag_cov, ...)

DEPRECATED: Use _build_correlation_matrix instead.

covariance_matrix_from_list(sigmas: list[ArrayWUnits], corr_matrix: ndarray) None#

DEPRECATED: Use _build_from_diagonal instead.

Constructs covariance matrix from diagonal elements and correlation matrix.

get_standard_deviations() ndarray#

Get standard deviations from the diagonal of the covariance matrix.

Returns:

Array of standard deviations (square root of diagonal elements).

Return type:

np.ndarray

matrix_without_units() ndarray#

Extract values from the covariance matrix without units.

Returns:

The covariance matrix as a numpy array without units.

Return type:

np.ndarray

reinitialize_with_matrix(new_matrix: ndarray, new_epoch: float | None = None, new_frame: str | None = None) Self#

Create a new CovarianceMatrix instance with updated matrix values.

Units are preserved from the original matrix where possible.

Parameters:
  • new_matrix (np.ndarray) – The new covariance matrix values.

  • new_epoch (float, optional) – New epoch value. If None, uses current epoch.

  • new_frame (str, optional) – New reference frame. If None, uses current frame.

Returns:

A new CovarianceMatrix instance with updated values.

Return type:

CovarianceMatrix

Raises:

ValueError – If new_matrix is not a numpy array or not square.

to_array() ndarray#

Convert covariance matrix to numpy array without units.

Returns:

The covariance matrix as a numpy array without units.

Return type:

np.ndarray

vector_to_correlation_matrix(diag_cov: list, upper_tri_vec: list) ndarray#

DEPRECATED: Use _build_correlation_matrix instead.

Converts vectors into a correlation matrix.

property definition#

The sequence or state definition.

property epoch: int#

The epoch of the uncertainty representation.

property frame: str#

The reference frame of the uncertainty representation.

property matrix: list[list[ArrayWUnits]]#

The covariance matrix as a list of lists.