MatrixProviderLinked
- class glotaran.optimization.matrix_provider.MatrixProviderLinked(group: DatasetGroup, data_provider: DataProviderLinked)[source]
Bases:
MatrixProvider
A class to provide matrix calculations for optimization of linked dataset groups.
Initialize a matrix provider for a linked dataset group.
- Parameters:
dataset_group (DatasetGroup) – The dataset group.
data_provider (DataProviderLinked) – The data provider.
Attributes Summary
Get the aligned full clp labels.
Get the dataset group.
Return number of conditionally linear parameters.
Methods Summary
Align the unreduced clp labels.
Align matrices.
Apply constraints on a matrix.
Apply relations on a matrix.
Calculate the matrices for optimization.
Calculate the aligned matrices of the dataset group.
Calculate the matrices of the datasets in the dataset group.
Calculate the matrix for a dataset on an index on the global axis.
Calculate the matrix for a dataset on an index on the global axis.
Check if an interval item applies on an index.
Get the aligned matrix container for an index on the aligned global axis.
Get the matrix container for a dataset on an index on the global axis.
Get the results of the matrix calculations.
Reduce a matrix.
Methods Documentation
- static align_matrices(matrices: list[MatrixContainer], scales: list[float]) MatrixContainer [source]
Align matrices.
- Parameters:
matrices (list[MatrixContainer]) – The matrices to align.
- Returns:
The aligned matrix container.
- Return type:
- 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:
- 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:
- 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:
- 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.
- 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:
- get_aligned_matrix_container(global_index: int) MatrixContainer [source]
Get the aligned matrix container for an index on the aligned global axis.
- Parameters:
global_index (int) – The index on the global axis.
- Returns:
The matrix container.
- Return type:
- 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:
- 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:
- 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: