dynamics
behaviour.dynamics
The symbolic layer, on every :class:Dynamics however it was built.
Attached to the generated classes by name (DynamicsBehaviour -> Dynamics), so a model loaded through LinkML, validated through Pydantic or resolved onto an edge answers the same symbolic questions as one constructed through :mod:tvbo.classes.dynamics.
That reach is the point. Consumers used to ask whether the model in hand had a symbolic layer and fall back to parsing its metadata directly when it did not — three copies of one dispatch, and two parses of the same equation against namespaces built differently.
The equations themselves live on a SymbolicSystem, one per model, held under a private attribute: both generated forms accept one without a slot and neither serializes it (tests/test_spec_model_contract.py).
Classes
| Name | Description |
|---|---|
| DynamicsBehaviour | Everything a model does, gathered where the generated class can inherit it. |
DynamicsBehaviour
behaviour.dynamics.DynamicsBehaviour()Everything a model does, gathered where the generated class can inherit it.
The symbolic view is here; construction, code generation, simulation, plotting and reporting come from DynamicsRuntime. One class because hatch_build attaches behaviour by name — DynamicsBehaviour to Dynamics — and splitting the source by concern is what keeps that one name readable.
Attributes
| Name | Description |
|---|---|
| keyed_parameters | Each parameter’s symbol mapped to its value, keyed for the codegen view. |
| symbolic | Full symbolic ODE system using proper SymPy conventions. |
| symbolic_system | This model’s SymbolicSystem, built once and kept. |
Methods
| Name | Description |
|---|---|
| check_units | Per-equation dimensional verdicts for this model. |
| get_equations | Collect the model’s equations as SymPy Eq objects. |
| get_symbolic_elements | The symbol table this model’s expressions are parsed against. |
| in_dependency_order | collection ordered so each member follows what it reads. |
| symbol_map | Display-symbol overrides for report rendering: {identifier Symbol: LaTeX str}. |
check_units
behaviour.dynamics.DynamicsBehaviour.check_units(
strictness='dimensional',
time_unit=None,
)Per-equation dimensional verdicts for this model.
See tvbo.analysis.units.check_units. Each verdict is consistent, inconsistent or underdetermined; the third is a distinct answer, not a soft failure, because 24 of the 39 curated models declare no units and calling those wrong would pressure fake declarations into the published record.
get_equations
behaviour.dynamics.DynamicsBehaviour.get_equations(
format='metadata',
evaluate=True,
)Collect the model’s equations as SymPy Eq objects.
The flat projection of SymbolicSystem.form: derived parameters, functions, derived variables, state equations (as time derivatives, or plain maps for discrete systems), and output transformations.
It rides on the layer rather than on the runtime Dynamics because the consumers that ask for it hold either flavour — a report’s per-node model on a heterogeneous network is the generated one, and promoting it to a runtime model just to ask re-parsed every equation the layer already held.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| format | str | Shape of the result. "dict" groups equations by category; "state-equations" returns only state equations keyed by variable name; any other value (e.g. "metadata") returns a single flat mapping of variable name to Eq. |
'metadata' |
| evaluate | bool | If True, let SymPy evaluate/simplify parsed right-hand sides; if False, preserve authored term order. |
True |
Returns
| Name | Type | Description |
|---|---|---|
A mapping of equations whose structure depends on format. |
Raises
| Name | Type | Description |
|---|---|---|
| ValueError | If an entry in output names neither a derived nor a state variable. |
get_symbolic_elements
behaviour.dynamics.DynamicsBehaviour.get_symbolic_elements(
include_time_symbol=True,
time_dependent=False,
)The symbol table this model’s expressions are parsed against.
See SymbolicSystem.scope. Returns a copy, so a caller may keep or adapt it.
in_dependency_order
behaviour.dynamics.DynamicsBehaviour.in_dependency_order(collection)collection ordered so each member follows what it reads.
What every backend emitting straight-line code iterates, in place of the collection itself. See SymbolicSystem.in_dependency_order: the order is settled on the parsed equations, so rendering stays a query and a model does not have to be rewritten before it can be emitted.
symbol_map
behaviour.dynamics.DynamicsBehaviour.symbol_map()Display-symbol overrides for report rendering: {identifier Symbol: LaTeX str}.