YmlProjectIo

class glotaran.builtin.io.yml.yml.YmlProjectIo(format_name: str)[source]

Bases: glotaran.io.interface.ProjectIoInterface

Initialize a Project IO plugin with the name of the format.

Parameters

format_name (str) – Name of the supported format an instance uses.

Methods Summary

load_model

parse_yaml_file reads the given file and parses its content as YML.

load_parameters

Create a ParameterGroup instance from the specs defined in a file.

load_result

Create a Result instance from the specs defined in a file.

load_scheme

Create a Scheme instance from the specs defined in a file (NOT IMPLEMENTED).

save_model

Save a Model instance to a spec file.

save_parameters

Save a ParameterGroup instance to a spec file (NOT IMPLEMENTED).

save_result

Write a Result instance to a spec file and data files.

save_scheme

Save a Scheme instance to a spec file (NOT IMPLEMENTED).

Methods Documentation

load_model(file_name: str) glotaran.model.model.Model[source]

parse_yaml_file reads the given file and parses its content as YML.

Parameters

filename (str) – filename is the of the file to parse.

Returns

The content of the file as dictionary.

Return type

Model

load_parameters(file_name: str) glotaran.parameter.parameter_group.ParameterGroup[source]

Create a ParameterGroup instance from the specs defined in a file. :param file_name: File containing the parameter specs. :type file_name: str

Returns

ParameterGroup instance created from the file.

Return type

ParameterGroup

load_result(result_path: str) glotaran.project.result.Result[source]

Create a Result instance from the specs defined in a file.

Parameters

result_path (str | PathLike[str]) – Path containing the result data.

Returns

Result instance created from the saved format.

Return type

Result

load_scheme(file_name: str) glotaran.project.scheme.Scheme[source]

Create a Scheme instance from the specs defined in a file (NOT IMPLEMENTED).

Parameters

file_name (str) – File containing the parameter specs.

Returns

  • Scheme – Scheme instance created from the file.

  • .. # noqa (DAR202)

  • .. # noqa (DAR401)

save_model(model: glotaran.model.model.Model, file_name: str)[source]

Save a Model instance to a spec file. :param model: Model instance to save to specs file. :type model: Model :param file_name: File to write the model specs to. :type file_name: str

save_parameters(parameters: ParameterGroup, file_name: str)

Save a ParameterGroup instance to a spec file (NOT IMPLEMENTED).

Parameters
  • parameters (ParameterGroup) – ParameterGroup instance to save to specs file.

  • file_name (str) – File to write the parameter specs to.

save_result(result: Result, result_path: str, saving_options: SavingOptions = SavingOptions(data_filter=None, data_format='nc', parameter_format='csv', report=True)) list[str][source]

Write a Result instance to a spec file and data files.

Returns a list with paths of all saved items. The following files are saved if not configured otherwise: * result.md: The result with the model formatted as markdown text. * result.yml: Yaml spec file of the result * model.yml: Model spec file. * scheme.yml: Scheme spec file. * initial_parameters.csv: Initially used parameters. * optimized_parameters.csv: The optimized parameter as csv file. * parameter_history.csv: Parameter changes over the optimization * {dataset_label}.nc: The result data for each dataset as NetCDF file.

Parameters
  • result (Result) – Result instance to write.

  • result_path (str | PathLike[str]) – Path to write the result data to.

  • saving_options (SavingOptions) – Options for saving the the result.

Returns

List of file paths which were created.

Return type

list[str]

save_scheme(scheme: glotaran.project.scheme.Scheme, file_name: str)[source]

Save a Scheme instance to a spec file (NOT IMPLEMENTED).

Parameters
  • scheme (Scheme) – Scheme instance to save to specs file.

  • file_name (str) – File to write the scheme specs to.