Parameter

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

Bases: _SupportsArray

A parameter for optimization.

Method generated by attrs for class Parameter.

Attributes Summary

label

value

standard_error

expression

maximum

minimum

non_negative

vary

transformed_expression

label_short

Get short label.

Methods Summary

as_dict

Get the parameter as a dictionary.

as_list

Get the parameter as a dictionary.

copy

Create a copy of the Parameter.

from_list

Create a parameter from a list.

get_value_and_bounds_for_optimization

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

markdown

Get a markdown representation of the parameter.

set_value_from_optimization

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

Methods Documentation

as_dict() dict[str, Any][source]

Get the parameter as a dictionary.

Returns:

The parameter as dictionary.

Return type:

dict[str, Any]

as_list(label_short: bool = False) list[str | float | dict[str, Any]][source]

Get the parameter as a dictionary.

Parameters:

label_short (bool) – If true, the label will be replaced by the shortened label.

Returns:

The parameter as dictionary.

Return type:

dict[str, Any]

copy() Parameter[source]

Create a copy of the Parameter.

Returns:

A copy of the Parameter.

Return type:

Parameter

expression: str | None
classmethod from_list(values: list[Any], *, default_options: dict[str, Any] | None = None) Parameter[source]

Create a parameter from a list.

Parameters:
  • values (list[Any]) – The list of parameter definitions.

  • default_options (dict[str, Any] | None) – A dictionary of default options.

Returns:

The created Parameter.

Return type:

Parameter

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

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

Returns:

A tuple containing the value, the lower and the upper bound.

Return type:

tuple[float, float, float]

label: str
property label_short: str

Get short label.

Returns:

The short label.

Return type:

str

markdown(all_parameters: Parameters | None = None, initial_parameters: Parameters | None = None) MarkdownStr[source]

Get a markdown representation of the parameter.

Parameters:
  • all_parameters (Parameters | None) – A parameter group containing the whole parameter set (used for expression lookup).

  • initial_parameters (Parameters | None) – The initial parameter.

Returns:

The parameter as markdown string.

Return type:

MarkdownStr

maximum: float
minimum: float
non_negative: bool
set_value_from_optimization(value: float)[source]

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

Parameters:

value (float) – Value from optimization.

standard_error: float
transformed_expression: str | None
value: float
vary: bool