OptimizationHistory

class glotaran.optimization.optimization_history.OptimizationHistory(data=None, source_path: StrOrPath | None = None)[source]

Bases: object

Wrapped DataFrame to hold information of the optimization and behaves like a DataFrame.

Ref.: https://stackoverflow.com/a/65375904/3990615

Ensure DataFrame has the correct columns, is numeric and has iteration as index.

Attributes Summary

data

Underlying DataFrame which allows for autocomplete with static analyzers.

Methods Summary

from_csv

Read OptimizationHistory from file.

from_stdout_str

Create OptimizationHistory instance from optimize_stdout.

loader

Read OptimizationHistory from file.

to_csv

Write a OptimizationHistory to a CSV file and set source_path.

Methods Documentation

property data: DataFrame

Underlying DataFrame which allows for autocomplete with static analyzers.

Returns:

DataFrame containing OptimizationHistory data.

Return type:

pd.DataFrame

classmethod from_csv(path: StrOrPath) OptimizationHistory[source]

Read OptimizationHistory from file.

Parameters:

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

Returns:

OptimizationHistory read from file.

Return type:

OptimizationHistory

classmethod from_stdout_str(optimize_stdout: str) OptimizationHistory[source]

Create OptimizationHistory instance from optimize_stdout.

Parameters:

optimize_stdout (str) – SciPy optimization stdout string, read out via TeeContext.read().

Returns:

OptimizationHistory instance created by parsing optimize_stdout.

Return type:

OptimizationHistory

classmethod loader(path: StrOrPath) OptimizationHistory

Read OptimizationHistory from file.

Parameters:

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

Returns:

OptimizationHistory read from file.

Return type:

OptimizationHistory

to_csv(path: StrOrPath, delimiter: str = ',')[source]

Write a OptimizationHistory to a CSV file and set source_path.

Parameters:
  • path (StrOrPath) – The path to the CSV file.

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