SimpleModelGenerator

class glotaran.testing.model_generators.SimpleModelGenerator(rates: list[float] = <factory>, k_matrix: Literal[('parallel', 'sequential')] | dict[tuple[str, str], str] = 'parallel', compartments: list[str] | None = None, irf: dict[str, float] = <factory>, initial_concentration: list[float] = <factory>, dispersion_coefficients: list[float] = <factory>, dispersion_center: float | None = None, default_megacomplex: str = 'decay')[source]

Bases: object

A minimal boilerplate model and parameters generator.

Generates a model (together with the parameters specification) based on parameter input values assigned to the generator’s attributes

Attributes Summary

compartments

A list of compartment names

default_megacomplex

The default_megacomplex identifier

dispersion_center

A value representing the dispersion center

k_matrix

"A dict with a k_matrix specification or Literal["parallel", "sequential"]

model

Return the generated model.

model_and_parameters

Return generated model and parameters.

model_dict

Return a dict representation of the generated model.

parameters

Return the generated parameters of type glotaran.parameter.ParameterGroup.

parameters_dict

Return a dict representation of the generated parameters.

valid

Check if the generator state is valid.

rates

A list of values representing decay rates

irf

A dict of items specifying an irf

initial_concentration

A list values representing the initial concentration

dispersion_coefficients

A list of values representing the dispersion coefficients

Methods Summary

markdown

Return a markdown string representation of the generated model and parameters.

validate

Call validate on the generated model and return its output.

Methods Documentation

compartments: list[str] | None = None

A list of compartment names

default_megacomplex: str = 'decay'

The default_megacomplex identifier

dispersion_center: float | None = None

A value representing the dispersion center

dispersion_coefficients: list[float]

A list of values representing the dispersion coefficients

initial_concentration: list[float]

A list values representing the initial concentration

irf: dict[str, float]

A dict of items specifying an irf

k_matrix: Literal['parallel', 'sequential'] | dict[tuple[str, str], str] = 'parallel'

“A dict with a k_matrix specification or Literal[“parallel”, “sequential”]

markdown() MarkdownStr[source]

Return a markdown string representation of the generated model and parameters.

Returns

A markdown string

Return type

MarkdownStr

property model: glotaran.model.model.Model

Return the generated model.

Returns

The generated model of type glotaran.model.Model.

Return type

Model

property model_and_parameters: tuple[Model, ParameterGroup]

Return generated model and parameters.

Returns

A model of type glotaran.model.Model and and parameters of type glotaran.parameter.ParameterGroup.

Return type

tuple[Model, ParameterGroup]

property model_dict: dict

Return a dict representation of the generated model.

Returns

A dict representation of the generated model.

Return type

dict

property parameters: glotaran.parameter.parameter_group.ParameterGroup

Return the generated parameters of type glotaran.parameter.ParameterGroup.

Returns

The generated parameters of type of type glotaran.parameter.ParameterGroup.

Return type

ParameterGroup

property parameters_dict: dict

Return a dict representation of the generated parameters.

Returns

A dict representing the generated parameters.

Return type

dict

rates: list[float]

A list of values representing decay rates

property valid: bool

Check if the generator state is valid.

Returns

Generator state obtained by calling the generated model’s valid function with the generated parameters as input.

Return type

bool

validate() str[source]

Call validate on the generated model and return its output.

Returns

A string listing problems in the generated model and parameters if any.

Return type

str