Scheme

class glotaran.project.scheme.Scheme(model: Model, parameters: Parameters, data: Mapping[str, xr.Dataset], clp_link_tolerance: float = 0.0, clp_link_method: Literal['nearest', 'backward', 'forward'] = 'nearest', maximum_number_function_evaluations: int | None = None, add_svd: bool = True, ftol: float = 1e-08, gtol: float = 1e-08, xtol: float = 1e-08, optimization_method: Literal['TrustRegionReflection', 'Dogbox', 'Levenberg-Marquardt'] = 'TrustRegionReflection', result_path: str | None = None)[source]

Bases: object

A scheme is a collection of a model, parameters and a dataset.

A scheme also holds options for optimization.

Attributes Summary

add_svd

clp_link_method

clp_link_tolerance

ftol

gtol

maximum_number_function_evaluations

optimization_method

result_path

source_path

xtol

model

parameters

data

Methods Summary

loader

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

markdown

Format the Scheme as markdown string.

valid

Check if there are no problems with the model or the parameters.

validate

Return a string listing all problems in the model and missing parameters.

Methods Documentation

add_svd: bool = True
data: Mapping[str, xr.Dataset]
ftol: float = 1e-08
gtol: float = 1e-08
loader(format_name: str | None = None, **kwargs: Any) Scheme

Create a Scheme 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_scheme implementation of the project io plugin.

Returns:

Scheme instance created from the file.

Return type:

Scheme

markdown()[source]

Format the Scheme as markdown string.

Returns:

The scheme as markdown string.

Return type:

MarkdownStr

maximum_number_function_evaluations: int | None = None
model: Model
optimization_method: Literal['TrustRegionReflection', 'Dogbox', 'Levenberg-Marquardt'] = 'TrustRegionReflection'
parameters: Parameters
result_path: str | None = None
source_path: StrOrPath = 'scheme.yml'
valid() bool[source]

Check if there are no problems with the model or the parameters.

Returns:

Whether the scheme is valid.

Return type:

bool

validate() MarkdownStr[source]

Return a string listing all problems in the model and missing parameters.

Returns:

A user-friendly string containing all the problems of a model if any. Defaults to ‘Your model is valid.’ if no problems are found.

Return type:

MarkdownStr

xtol: float = 1e-08