DataProvider
- class glotaran.optimization.data_provider.DataProvider(scheme: Scheme, dataset_group: DatasetGroup)[source]
Bases:
object
A class to provide prepared data for optimization.
Initialize a data provider for a scheme and a dataset_group.
- Parameters:
scheme (Scheme) – The optimization scheme.
dataset_group (DatasetGroup) – The dataset group.
Methods Summary
Add model weight to data.
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)[source]
Add model weight to data.
- static get_axis_slice_from_interval(interval: tuple[float, float], axis: ArrayLike) slice [source]
Get a slice of indices from a min max tuple and for an axis.
- get_data(dataset_label: str) ArrayLike [source]
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 [source]
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 [source]
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 [source]
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 [source]
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 [source]
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 [source]
Get weight for a dataset.
- Parameters:
dataset_label (str) – The label of the data.
- Returns:
The weight.
- Return type:
ArrayLike | None