ParameterHistory

class glotaran.parameter.parameter_history.ParameterHistory[source]

Bases: object

A class representing a history of parameters.

Attributes Summary

number_of_records

Return the number of records in the history.

parameter_labels

Return the labels of the parameters in the history.

parameters

Return the parameters in the history.

Methods Summary

append

Append a ParameterGroup to the history.

from_csv

Create a history from a csv file.

from_dataframe

Create a history from a pandas data frame.

get_parameters

Get parameters for a history index.

loader

Create a history from a csv file.

to_csv

Write a ParameterGroup to a CSV file.

to_dataframe

Create a data frame from the history.

Methods Documentation

append(parameter_group: glotaran.parameter.parameter_group.ParameterGroup)[source]

Append a ParameterGroup to the history.

Parameters

parameter_group (ParameterGroup) – The group to append.

Raises

ValueError – Raised if the parameter labels of the group differs from previous groups.

classmethod from_csv(path: str) glotaran.parameter.parameter_history.ParameterHistory[source]

Create a history from a csv file.

Parameters

path (str) – The path to the csv file.

Returns

The created history.

Return type

ParameterHistory

classmethod from_dataframe(history_df: pandas.core.frame.DataFrame) glotaran.parameter.parameter_history.ParameterHistory[source]

Create a history from a pandas data frame.

Parameters

history_df (pd.DataFrame) – The source data frame.

Returns

The created history.

Return type

ParameterHistory

get_parameters(index: int) numpy.ndarray[source]

Get parameters for a history index.

Parameters

index (int) – The history index.

Returns

The parameter values at the history index as array.

Return type

np.ndarray

classmethod loader(path: str) glotaran.parameter.parameter_history.ParameterHistory

Create a history from a csv file.

Parameters

path (str) – The path to the csv file.

Returns

The created history.

Return type

ParameterHistory

property number_of_records: int

Return the number of records in the history.

Returns

The number of records.

Return type

int

property parameter_labels: list[str]

Return the labels of the parameters in the history.

Returns

A list of parameter labels.

Return type

list[str]

property parameters: list[np.ndarray]

Return the parameters in the history.

Returns

A list of parameters in the history.

Return type

list[np.ndarray]

to_csv(file_name: str | PathLike[str], delimiter: str = ',')[source]

Write a ParameterGroup to a CSV file.

Parameters
  • file_name (str) – The path to the CSV file.

  • delimiter (str) – The delimiter of the CSV file.

to_dataframe() pandas.core.frame.DataFrame[source]

Create a data frame from the history.

Returns

The created data frame.

Return type

pd.DataFrame