DataProviderLinked
- class glotaran.optimization.data_provider.DataProviderLinked(scheme: Scheme, dataset_group: DatasetGroup)[source]
Bases:
DataProvider
A class to provide aligned data for optimization.
Initialize a linked data provider for a scheme and a dataset_group.
- Parameters:
scheme (Scheme) – The optimization scheme.
dataset_group (DatasetGroup) – The dataset group.
Attributes Summary
Get the aligned global axis for the dataset group.
Get the group definitions for the dataset group.
Methods Summary
Add model weight to data.
Align the data in a dataset group.
Align the global indices in a dataset group.
Align the groups in a dataset group.
Align an index on a target axis.
Align the weights in a dataset group.
Create aligned global axes for the dataset group.
Get the aligned data for an index.
Get the aligned dataset indices for an index.
Get the group label for an index.
Get the aligned weight for an index.
Get a slice of indices from a min max tuple and for an axis.
Get data for a dataset.
Get flattened data for a dataset.
Get flattened weight for a dataset.
Get a copy of data from a dataset with dimensions (model, global).
Get the global axis for a dataset.
Get the global dimension for a dataset.
Get the model axis for a dataset.
Get the model dimension for a dataset.
Get weight for a dataset.
Infer the name of the global dimension from tuple of dimensions.
Methods Documentation
- add_model_weight(model: Model, dataset_label: str, model_dimension: str, global_dimension: str)
Add model weight to data.
- align_data(aligned_global_axes: dict[str, ArrayLike]) tuple[ArrayLike, list[ArrayLike]] [source]
Align the data in a dataset group.
- align_dataset_indices(aligned_global_axes: dict[str, ArrayLike]) list[ArrayLike] [source]
Align the global indices in a dataset group.
- static align_groups(aligned_global_axes: dict[str, ArrayLike]) tuple[ArrayLike, dict[str, list[str]]] [source]
Align the groups in a dataset group.
- static align_index(index: int, target_axis: ArrayLike, tolerance: float, method: Literal['nearest', 'backward', 'forward']) int [source]
Align an index on a target axis.
- align_weights(aligned_global_axes: dict[str, ArrayLike]) list[ArrayLike | None] [source]
Align the weights in a dataset group.
- property aligned_global_axis: ArrayLike
Get the aligned global axis for the dataset group.
- Returns:
The aligned global axis.
- Return type:
ArrayLike
- create_aligned_global_axes(scheme: Scheme) dict[str, ArrayLike] [source]
Create aligned global axes for the dataset group.
- get_aligned_data(index: int) ArrayLike [source]
Get the aligned data for an index.
- Parameters:
index (int) – The index on the aligned global axis.
- Returns:
The aligned data.
- Return type:
ArrayLike
- get_aligned_dataset_indices(index: int) ArrayLike [source]
Get the aligned dataset indices for an index.
- Parameters:
index (int) – The index on the aligned global axis.
- Returns:
The aligned dataset indices.
- Return type:
ArrayLike
- get_aligned_weight(index: int) ArrayLike | None [source]
Get the aligned weight for an index.
- Parameters:
index (int) – The index on the aligned global axis.
- Returns:
The aligned weight.
- Return type:
ArrayLike | None
- static get_axis_slice_from_interval(interval: tuple[float, float], axis: ArrayLike) slice
Get a slice of indices from a min max tuple and for an axis.
- get_data(dataset_label: str) ArrayLike
Get data for a dataset.
- Parameters:
dataset_label (str) – The label of the data.
- Returns:
The data.
- Return type:
ArrayLike
- get_flattened_data(dataset_label: str) ArrayLike
Get flattened data for a dataset.
- Parameters:
dataset_label (str) – The label of the data.
- Returns:
The flattened data.
- Return type:
ArrayLike
- get_flattened_weight(dataset_label: str) ArrayLike | None
Get flattened weight for a dataset.
- Parameters:
dataset_label (str) – The label of the data.
- Returns:
The flattened weight.
- Return type:
ArrayLike | None
- static get_from_dataset(dataset: xr.Dataset, name: str, model_dimension: str, global_dimension: str) ArrayLike | None
Get a copy of data from a dataset with dimensions (model, global).
- Parameters:
- Returns:
The copy of the data. None if name is not present in dataset.
- Return type:
ArrayLike | None
- get_global_axis(dataset_label: str) ArrayLike
Get the global axis for a dataset.
- Parameters:
dataset_label (str) – The label of the data.
- Returns:
The global axis.
- Return type:
ArrayLike
- get_model_axis(dataset_label: str) ArrayLike
Get the model axis for a dataset.
- Parameters:
dataset_label (str) – The label of the data.
- Returns:
The model axis.
- Return type:
ArrayLike
- get_weight(dataset_label: str) ArrayLike | None
Get weight for a dataset.
- Parameters:
dataset_label (str) – The label of the data.
- Returns:
The weight.
- Return type:
ArrayLike | None