EstimationProvider

class glotaran.optimization.estimation_provider.EstimationProvider(dataset_group: DatasetGroup)[source]

Bases: object

A class to provide estimation for optimization.

Initialize an estimation provider for a dataset group.

Parameters:

dataset_group (DatasetGroup) – The dataset group.

Raises:

UnsupportedResidualFunctionError – Raised when residual function of the group dataset group is unsupported.

Attributes Summary

group

Get the dataset group.

Methods Summary

calculate_clp_penalties

Calculate the clp penalty.

calculate_residual

Calculate the clps and the residual for a matrix and data.

estimate

Calculate the estimation.

get_additional_penalties

Get the additional penalty.

get_full_penalty

Get the full penalty.

get_result

Get the results of the estimation.

retrieve_clps

Retrieve clp from reduced clp.

Methods Documentation

calculate_clp_penalties(clp_labels: list[list[str]], clps: list[ndarray], global_axis: ndarray) list[float][source]

Calculate the clp penalty.

Parameters:
  • clp_labels (list[list[str]]) – The clp labels.

  • clps (list[ArrayLike]) – The clps.

  • global_axis (ArrayLike) – The global axis.

Returns:

The clp penalty.

Return type:

list[float]

calculate_residual(matrix: ArrayLike, data: ArrayLike) tuple[ArrayLike, ArrayLike][source]

Calculate the clps and the residual for a matrix and data.

Parameters:
  • matrix (ArrayLike) – The matrix.

  • data (ArrayLike) – The data.

Returns:

The estimated clp and residual.

Return type:

tuple[ArrayLike, ArrayLike]

estimate()[source]

Calculate the estimation.

get_additional_penalties() list[float][source]

Get the additional penalty.

Returns:

The additional penalty.

Return type:

list[float]

get_full_penalty() ArrayLike[source]

Get the full penalty.

Returns:

  • ArrayLike – The clp penalty.

  • .. # noqa (DAR202)

  • .. # noqa (DAR401)

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

Get the results of the estimation.

Returns:

  • tuple[dict[str, xr.DataArray], dict[str, xr.DataArray]] – A tuple of the estimated clps and residuals.

  • .. # noqa (DAR202)

  • .. # noqa (DAR401)

property group: DatasetGroup

Get the dataset group.

Returns:

The dataset group.

Return type:

DatasetGroup

retrieve_clps(clp_labels: list[str], reduced_clp_labels: list[str], reduced_clps: ArrayLike, index: int) ArrayLike[source]

Retrieve clp from reduced clp.

Parameters:
  • clp_labels (list[str]) – The original clp labels.

  • reduced_clp_labels (list[str]) – The reduced clp labels.

  • reduced_clps (ArrayLike) – The reduced clps.

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

Returns:

The retrieved clps.

Return type:

ArrayLike