MatrixProviderUnlinked

class glotaran.optimization.matrix_provider.MatrixProviderUnlinked(group: DatasetGroup, data_provider: DataProvider)[source]

Bases: MatrixProvider

A class to provide matrix calculations for optimization of unlinked dataset groups.

Initialize a matrix provider for an unlinked dataset group.

Parameters:

Attributes Summary

group

Get the dataset group.

number_of_clps

Return number of conditionally linear parameters.

Methods Summary

apply_constraints

Apply constraints on a matrix.

apply_relations

Apply relations on a matrix.

calculate

Calculate the matrices for optimization.

calculate_dataset_matrices

Calculate the matrices of the datasets in the dataset group.

calculate_dataset_matrix

Calculate the matrix for a dataset on an index on the global axis.

calculate_full_matrices

Calculate the full matrices of the datasets in the dataset group.

calculate_global_matrices

Calculate the global matrices of the datasets in the dataset group.

calculate_prepared_matrices

Calculate the prepared matrices of the datasets in the dataset group.

combine_megacomplex_matrices

Calculate the matrix for a dataset on an index on the global axis.

does_interval_item_apply

Check if an interval item applies on an index.

get_full_matrix

Get the full matrix of a dataset.

get_global_matrix_container

Get the global matrix container for a dataset.

get_matrix_container

Get the matrix container for a dataset on an index on the global axis.

get_prepared_matrix_container

Get the prepared matrix container for a dataset on an index on the global axis.

get_result

Get the results of the matrix calculations.

reduce_matrix

Reduce a matrix.

Methods Documentation

apply_constraints(matrices: list[MatrixContainer], global_axis: ArrayLike) list[MatrixContainer]

Apply constraints on a matrix.

Parameters:
  • matrices (list[MatrixContainer],) – The matrices.

  • global_axis (ArrayLike) – The global axis.

Returns:

The resulting matrix container.

Return type:

MatrixContainer

apply_relations(matrices: list[MatrixContainer], global_axis: ArrayLike) list[MatrixContainer]

Apply relations on a matrix.

Parameters:
  • matrices (list[MatrixContainer],) – The matrices.

  • global_axis (ArrayLike) – The global axis.

Returns:

The resulting matrix container.

Return type:

MatrixContainer

calculate()[source]

Calculate the matrices for optimization.

calculate_dataset_matrices()

Calculate the matrices of the datasets in the dataset group.

static calculate_dataset_matrix(dataset_model: DatasetModel, global_axis: ArrayLike, model_axis: ArrayLike, global_matrix: bool = False) MatrixContainer

Calculate the matrix for a dataset on an index on the global axis.

Parameters:
  • dataset_model (DatasetModel) – The dataset model.

  • global_axis (ArrayLike) – The global axis.

  • model_axis (ArrayLike) – The model axis.

  • global_matrix (bool) – Calculate the global megacomplexes if True.

Returns:

The resulting matrix container.

Return type:

MatrixContainer

calculate_full_matrices()[source]

Calculate the full matrices of the datasets in the dataset group.

calculate_global_matrices()[source]

Calculate the global matrices of the datasets in the dataset group.

calculate_prepared_matrices()[source]

Calculate the prepared matrices of the datasets in the dataset group.

static combine_megacomplex_matrices(matrix_left: ArrayLike, matrix_right: ArrayLike, clp_labels_left: list[str], clp_labels_right: list[str]) tuple[list[str], ArrayLike]

Calculate the matrix for a dataset on an index on the global axis.

Parameters:
  • matrix_left (ArrayLike) – The left matrix.

  • matrix_right (ArrayLike) – The right matrix.

  • clp_labels_left (list[str]) – The left clp labels.

  • clp_labels_right (list[str]) – The right clp labels.

Returns:

The combined clp labels and matrix.

Return type:

tuple[list[str], ArrayLike]

static does_interval_item_apply(prop: IntervalItem, index: int | None) bool

Check if an interval item applies on an index.

Parameters:
  • prop (IntervalItem) – The interval property.

  • index (int | None) – The index to check.

Returns:

Whether the property applies.

Return type:

bool

get_full_matrix(dataset_label: str) ArrayLike[source]

Get the full matrix of a dataset.

Parameters:

dataset_label (str) – The label of the dataset.

Returns:

The matrix.

Return type:

ArrayLike

get_global_matrix_container(dataset_label: str) MatrixContainer[source]

Get the global matrix container for a dataset.

Parameters:

dataset_label (str) – The label of the dataset.

Returns:

The matrix container.

Return type:

MatrixContainer

get_matrix_container(dataset_label: str) MatrixContainer

Get the matrix container for a dataset on an index on the global axis.

Parameters:

dataset_label (str) – The label of the dataset.

Returns:

The matrix container.

Return type:

MatrixContainer

get_prepared_matrix_container(dataset_label: str, global_index: int) MatrixContainer[source]

Get the prepared matrix container for a dataset on an index on the global axis.

Parameters:
  • dataset_label (str) – The label of the dataset.

  • global_index (int) – The index on the global axis.

Returns:

The matrix container.

Return type:

MatrixContainer

get_result() tuple[dict[str, DataArray], dict[str, DataArray]]

Get the results of the matrix calculations.

Returns:

  • tuple[dict[str, xr.DataArray], dict[str, xr.DataArray]] – A tuple of the matrices and global matrices.

  • .. # noqa (DAR202)

  • .. # noqa (DAR401)

property group: DatasetGroup

Get the dataset group.

Returns:

The dataset group.

Return type:

DatasetGroup

property number_of_clps: int

Return number of conditionally linear parameters.

Return type:

int

reduce_matrix(matrix: MatrixContainer, global_axis: ArrayLike) list[MatrixContainer]

Reduce a matrix.

Applies constraints and relations.

Parameters:
  • matrix (MatrixContainer) – The matrix.

  • global_axis (ArrayLike) – The global axis.

Returns:

The resulting matrix container.

Return type:

MatrixContainer