Problem

class glotaran.analysis.problem.Problem(scheme: glotaran.project.scheme.Scheme)[source]

Bases: object

A Problem class

Initializes the Problem class from a scheme (glotaran.analysis.scheme.Scheme)

Args:
scheme (Scheme): An instance of glotaran.analysis.scheme.Scheme

which defines your model, parameters, and data

Attributes Summary

additional_penalty

bag

clp_labels

clps

cost

data

filled_dataset_descriptors

full_penalty

grouped

groups

index_dependent

matrices

model

Property providing access to the used model

parameter_history

parameters

reduced_clp_labels

reduced_clps

reduced_matrices

residuals

scheme

Property providing access to the used scheme

weighted_residuals

Methods Summary

calculate_additional_penalty

Calculates additional penalties by calling the model.additional_penalty function.

calculate_index_dependent_matrices

Calculates the index dependent model matrices.

calculate_index_dependent_residual

Calculates the index dependent residuals.

calculate_index_independent_matrices

Calculates the index independent model matrices.

calculate_index_independent_residual

Calculates the index independent residuals.

calculate_matrices

calculate_residual

create_index_dependent_result_dataset

Creates a result datasets for index dependent matrices.

create_index_independent_result_dataset

Creates a result datasets for index independent matrices.

create_result_data

create_result_dataset

init_bag

Initializes a problem bag.

reset

Resets all results and DatasetDescriptors.

save_parameters_for_history

Methods Documentation

property additional_penalty: dict[str, list[float]]
property bag: UngroupedBag | GroupedBag
calculate_additional_penalty() np.ndarray | dict[str, np.ndarray][source]

Calculates additional penalties by calling the model.additional_penalty function.

calculate_index_dependent_matrices() tuple[dict[str, list[list[str]]], dict[str, list[np.ndarray]], dict[str, list[str]], dict[str, list[np.ndarray]]][source]

Calculates the index dependent model matrices.

calculate_index_dependent_residual() tuple[dict[str, list[np.ndarray]], dict[str, list[np.ndarray]], dict[str, list[np.ndarray]], dict[str, list[np.ndarray]]][source]

Calculates the index dependent residuals.

calculate_index_independent_matrices() tuple[dict[str, list[str]], dict[str, np.ndarray], dict[str, list[str]], dict[str, np.ndarray]][source]

Calculates the index independent model matrices.

calculate_index_independent_residual() tuple[dict[str, list[np.ndarray]], dict[str, list[np.ndarray]], dict[str, list[np.ndarray]], dict[str, list[np.ndarray]]][source]

Calculates the index independent residuals.

calculate_matrices()[source]
calculate_residual()[source]
property clp_labels: dict[str, list[str] | list[list[str]]]
property clps: dict[str, list[np.ndarray]]
property cost: float
create_index_dependent_result_dataset(label: str, dataset: xarray.core.dataset.Dataset) xarray.core.dataset.Dataset[source]

Creates a result datasets for index dependent matrices.

create_index_independent_result_dataset(label: str, dataset: xarray.core.dataset.Dataset) xarray.core.dataset.Dataset[source]

Creates a result datasets for index independent matrices.

create_result_data(copy: bool = True, history_index: int | None = None) dict[str, xr.Dataset][source]
create_result_dataset(label: str, copy: bool = True) xarray.core.dataset.Dataset[source]
property data: dict[str, xr.Dataset]
property filled_dataset_descriptors: dict[str, DatasetDescriptor]
property full_penalty: numpy.ndarray
property grouped: bool
property groups: dict[str, list[str]]
property index_dependent: bool
init_bag()[source]

Initializes a problem bag.

property matrices: dict[str, np.ndarray | list[np.ndarray]]
property model: glotaran.model.base_model.Model

Property providing access to the used model

The model is a subclass of glotaran.model.Model decorated with the @model decorator glotaran.model.model_decorator.model For an example implementation see e.g. glotaran.builtin.models.kinetic_spectrum

Returns:
Model: A subclass of glotaran.model.Model

The model must be decorated with the @model decorator glotaran.model.model_decorator.model

property parameter_history: list[ParameterGroup]
property parameters: glotaran.parameter.parameter_group.ParameterGroup
property reduced_clp_labels: dict[str, list[str] | list[list[str]]]
property reduced_clps: dict[str, list[np.ndarray]]
property reduced_matrices: dict[str, np.ndarray] | dict[str, list[np.ndarray]] | list[np.ndarray]
reset()[source]

Resets all results and DatasetDescriptors. Use after updating parameters.

property residuals: dict[str, list[np.ndarray]]
save_parameters_for_history()[source]
property scheme: glotaran.project.scheme.Scheme

Property providing access to the used scheme

Returns:
Scheme: An instance of glotaran.analysis.scheme.Scheme

Provides access to data, model, parameters and optimization arguments.

property weighted_residuals: dict[str, list[np.ndarray]]