Compartment#

class dynode.config.simulation_config.Compartment(*, name: Annotated[str, BeforeValidator(func=_verify_name, json_schema_input_type=PydanticUndefined)], dimensions: List[Dimension])#

Bases: BaseModel

Defines a single compartment of an ODE model.

__init__(**data: Any) None#

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Methods

Attributes

idx

An enum-like structure for dimensions and their bins.

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

shape

Get shape of the compartment.

name

dimensions

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: Annotated[str, BeforeValidator(func=_verify_name, json_schema_input_type=PydanticUndefined)]#
dimensions: List[Dimension]#
_validate_dimensions_names()#

Assert that all dimensions in the Compartment have unique names.

property shape: tuple[int, ...]#

Get shape of the compartment.

property idx#

An enum-like structure for dimensions and their bins.

Note#

This is a cache property, so it will only be computed once, modifications to the compartment will not change the idx after it is created.

Returns#

SimpleNamespace: A namespace containing dimensions and their bins.

_abc_impl = <_abc._abc_data object>#