Models

Schema for model definitions

class pigreads.schema.model.ModelDefinition(**data)

Bases: BaseModel

Definition of a so-called model, i.e., the reaction-term.

Note: Additional fields are allowed stored in meta.

See:

pigreads.models.Models and ModelEntry

Parameters:

data (Any)

__call__(**parameters)

Merge diffusivities, default parameters, and given parameters.

Parameters:

parameters (float) – Additional parameters.

Return type:

dict[str, float]

Returns:

Merged parameter dictionary.

property all_parameters: dict[str, float]

Dictionary of parameters including the diffusivities.

code: str

Source code of the forward Euler step in OpenCL.

description: str

A simple description of the model, what it was designed for, and its unique features.

diffusivity: dict[str, float]

Dictionary that maps the names of variables to diffuse to their diffusivity.

dois: list[str]

List of digital object identifiers in URL form, i.e., starting with https://doi.org/10.

property meta: dict[str, Any]

Read-only view of additional fields, i.e., metadata.

model_config: ClassVar[ConfigDict]

Configuration for pydantic.BaseModel.

name: str

Human readable name of the model, usually the authors and the year.

parameters: dict[str, float]

Model parameter names and their default values.

variables: dict[str, float]

Model variable names and their resting/initial values.

class pigreads.schema.model.ModelEntry(**data)

Bases: BaseModel

A model entry chooses a model by its key and which parameters to use.

See:

pigreads.models.Models and ModelDefinition

Parameters:

data (Any)

key: str

The key of the model.

model_config: ClassVar[ConfigDict]

Configuration for pydantic.BaseModel.

classmethod normalise(values)

Normalise the model entry.

If the entry is a string, it is converted to a dictionary with an empty parameter set. If the entry is a dictionary with a single key, the key is used as the model key.

Parameters:

values (Any) – Any data to try to interpret.

Return type:

Any

Returns:

Normalised data.

parameters: MutableMapping[str, float]

The parameters of the model.