Parameters
- class glotaran.parameter.parameters.Parameters(parameters: dict[str, Parameter])[source]
Bases:
object
A container for
Parameter
.Create
Parameters
.- Parameters:
parameters (dict[str, Parameter]) – A parameter list containing parameters
- Returns:
The created
Parameters
.- Return type:
‘Parameters’
Attributes Summary
List of all labels.
Methods Summary
Iterate over all parameters.
Create a copy of the
Parameters
.Create a
Parameters
from apandas.DataFrame
.Create a
Parameters
from a dictionary.Create
Parameters
from a list.Create
Parameters
from a list of parameter dictionaries.Get a
Parameter
by its label.Return a arrays of all parameter labels, values and bounds.
Check if a parameter with the given label is in the group or in a subgroup.
Create a
Parameters
instance from the specs defined in a file.Format the
ParameterGroup
as markdown string.Update the
Parameters
with values from a parameter history.Update the parameter values from a list of labels and values.
Create a pandas data frame from the group.
Create list of parameter dictionaries from the group.
Convert to a dict or list of parameter definitions.
Update all parameters which have an expression.
Methods Documentation
- all() Generator[Parameter, None, None] [source]
Iterate over all parameters.
- Yields:
Parameter – A parameter in the parameters.
- copy() Parameters [source]
Create a copy of the
Parameters
.- Returns:
Parameters – A copy of the
Parameters
... # noqa (D414)
- classmethod from_dataframe(df: DataFrame, source: str = 'DataFrame') Parameters [source]
Create a
Parameters
from apandas.DataFrame
.- Parameters:
df (pd.DataFrame) – The source data frame.
source (str) – Optional name of the source file, used for error messages.
- Raises:
ValueError – Raised if the columns ‘label’ or ‘value’ doesn’t exist. Also raised if the columns ‘minimum’, ‘maximum’ or ‘values’ contain non numeric values or if the columns ‘non-negative’ or ‘vary’ are no boolean.
- Returns:
Parameters – The created parameter group.
.. # noqa (D414)
- classmethod from_dict(parameter_dict: dict[str, dict[str, Any] | list[float | list[Any]]]) Parameters [source]
Create a
Parameters
from a dictionary.
- classmethod from_list(parameter_list: list[float | int | str | list[Any] | dict[str, Any]]) Parameters [source]
Create
Parameters
from a list.- Parameters:
parameter_list (list[float | list[Any]]) – A parameter list containing parameters
- Returns:
Parameters – The created
Parameters
... # noqa (D414)
- classmethod from_parameter_dict_list(parameter_dict_list: list[dict[str, Any]]) Parameters [source]
Create
Parameters
from a list of parameter dictionaries.- Parameters:
parameter_dict_list (list[dict[str, Any]]) – A list of parameter dictionaries.
- Returns:
Parameters – The created
Parameters
... # noqa (D414)
- get_label_value_and_bounds_arrays(exclude_non_vary: bool = False) tuple[list[str], ndarray, ndarray, ndarray] [source]
Return a arrays of all parameter labels, values and bounds.
- has(label: str) bool [source]
Check if a parameter with the given label is in the group or in a subgroup.
- loader(format_name: str | None = None, **kwargs) Parameters
Create a
Parameters
instance from the specs defined in a file.- Parameters:
file_name (StrOrPath) – File containing the parameter specs.
format_name (str | None) – Format the file is in, if not provided it will be inferred from the file extension.
**kwargs (Any) – Additional keyword arguments passes to the
load_parameters
implementation of the project io plugin.
- Returns:
Parameters –
Parameters
instance created from the file... # noqa (D414)
- markdown(float_format: str = '.3e') MarkdownStr [source]
Format the
ParameterGroup
as markdown string.This is done by recursing the nested
ParameterGroup
tree.- Parameters:
float_format (str) – Format string for floating point numbers, by default “.3e”
- Returns:
The markdown representation as string.
- Return type:
- set_from_history(history: ParameterHistory, index: int)[source]
Update the
Parameters
with values from a parameter history.- Parameters:
history (ParameterHistory) – The parameter history.
index (int) – The history index.
- set_from_label_and_value_arrays(labels: list[str], values: ndarray)[source]
Update the parameter values from a list of labels and values.
- Parameters:
- Raises:
ValueError – Raised if the size of the labels does not match the stize of values.
- to_dataframe() DataFrame [source]
Create a pandas data frame from the group.
- Returns:
The created data frame.
- Return type:
pd.DataFrame
- to_parameter_dict_list() list[dict[str, Any]] [source]
Create list of parameter dictionaries from the group.
- to_parameter_dict_or_list(serialize_parameters: bool = False) dict | list [source]
Convert to a dict or list of parameter definitions.
- update_parameter_expression()[source]
Update all parameters which have an expression.
- Raises:
ValueError – Raised if an expression evaluates to a non-numeric value.