Parameter

class glotaran.parameter.parameter.Parameter(label: str = None, full_label: str = None, expression: str = None, maximum: int | float = inf, minimum: int | float = - inf, non_negative: bool = False, value: float | int = nan, vary: bool = True)[source]

Bases: numpy.typing._array_like._SupportsArray

A parameter for optimization.

Optimization Parameter supporting numpy array operations.

Parameters
  • label (str, optional) – The label of the parameter., by default None

  • full_label (str, optional) – The label of the parameter with its path in a parameter group prepended. , by default None

  • expression (str, optional) – Expression to calculate the parameters value from, e.g. if used in relation to another parameter. , by default None

  • maximum (int, optional) – Upper boundary for the parameter to be varied to., by default np.inf

  • minimum (int, optional) – Lower boundary for the parameter to be varied to., by default -np.inf

  • non_negative (bool, optional) – Whether the parameter should always be bigger than zero., by default False

  • value (float, optional) – Value of the parameter, by default np.nan

  • vary (bool, optional) – Whether the parameter should be changed during optimization or not. , by default True

Attributes Summary

expression

Expression to calculate the parameters value from.

full_label

The label of the parameter with its path in a parameter group prepended.

label

Label of the parameter

maximum

The upper bound of the parameter.

minimum

The lower bound of the parameter.

non_negative

Indicates if the parameter is non-negativ.

standard_error

The standard error of the optimized parameter.

transformed_expression

The expression of the parameter transformed for evaluation within a ParameterGroup.

value

The value of the parameter

vary

Indicates if the parameter should be optimized.

Methods Summary

from_list_or_value

Creates a parameter from a list or numeric value.

get_value_and_bounds_for_optimization

Gets the parameter value and bounds with expression and non-negative constraints applied.

set_from_group

Sets all values of the parameter to the values of the corresponding parameter in the group.

set_value_from_optimization

Sets the value from an optimization result and reverses non-negative transformation.

valid_label

Returns true if the label is valid string.

Methods Documentation

property expression: str | None

Expression to calculate the parameters value from.

This can used to set a relation to another parameter.

classmethod from_list_or_value(value: int | float | list, default_options: dict = None, label: str = None) Parameter[source]

Creates a parameter from a list or numeric value.

Parameters
  • value – The list or numeric value.

  • default_options – A dictionary of default options.

  • label – The label of the parameter.

property full_label: str

The label of the parameter with its path in a parameter group prepended.

get_value_and_bounds_for_optimization() tuple[float, float, float][source]

Gets the parameter value and bounds with expression and non-negative constraints applied.

property label: str | None

Label of the parameter

property maximum: float

The upper bound of the parameter.

property minimum: float

The lower bound of the parameter.

property non_negative: bool

Indicates if the parameter is non-negativ.

If true, the parameter will be transformed with p' = \log{p} and p = \exp{p'}.

Always False if expression is not None.

set_from_group(group: ParameterGroup)[source]

Sets all values of the parameter to the values of the corresponding parameter in the group.

Notes

For internal use.

Parameters

group – The glotaran.parameter.ParameterGroup.

set_value_from_optimization(value: float)[source]

Sets the value from an optimization result and reverses non-negative transformation.

property standard_error: float

The standard error of the optimized parameter.

property transformed_expression: str | None

The expression of the parameter transformed for evaluation within a ParameterGroup.

classmethod valid_label(label: str) bool[source]

Returns true if the label is valid string.

property value: float

The value of the parameter

property vary: bool

Indicates if the parameter should be optimized.

Always False if expression is not None.