Simulator¶
simulator
¶
Simulation orchestration for flepimop2.
Simulator(system, engine, backend, *, target=None, simulate_config=None, system_config=None, engine_config=None, backend_config=None)
¶
Build and run a single simulation from configuration models.
Attributes:
| Name | Type | Description |
|---|---|---|
system |
SystemABC
|
The built system instance. |
engine |
EngineABC
|
The built engine instance. |
backend |
BackendABC
|
The built backend instance. |
target |
str | None
|
Optional target simulate config to use. |
simulate_config |
SimulateSpecificationModel | None
|
The resolved simulation specification. |
system_config |
ModuleModel | None
|
The resolved system configuration dict. |
engine_config |
ModuleModel | None
|
The resolved engine configuration dict. |
backend_config |
ModuleModel | None
|
The resolved backend configuration dict. |
Initialize the simulator with resolved components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
system
|
SystemABC
|
The built system instance. |
required |
engine
|
EngineABC
|
The built engine instance. |
required |
backend
|
BackendABC
|
The built backend instance. |
required |
target
|
str | None
|
Optional target simulate config to use. |
None
|
simulate_config
|
SimulateSpecificationModel | None
|
The resolved simulation specification, if available. |
None
|
system_config
|
ModuleModel | None
|
The resolved system configuration model, if available. |
None
|
engine_config
|
ModuleModel | None
|
The resolved engine configuration model, if available. |
None
|
backend_config
|
ModuleModel | None
|
The resolved backend configuration model, if available. |
None
|
Raises:
| Type | Description |
|---|---|
Flepimop2ValidationError
|
If the engine is incompatible with the system. |
Source code in src/flepimop2/simulator.py
from_configuration_model(config_model, target=None)
classmethod
¶
Build a simulator from a configuration model.
Returns:
| Type | Description |
|---|---|
Simulator
|
The constructed simulator instance. |
Source code in src/flepimop2/simulator.py
run(initial_state, params, meta=None)
¶
Run the simulation and persist results via the backend.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
initial_state
|
Float64NDArray
|
The initial state array for the simulation. |
required |
params
|
dict[str, float]
|
The parameter dict for the simulation. |
required |
meta
|
RunMeta | None
|
Metadata about the simulation run. |
None
|
Returns:
| Type | Description |
|---|---|
Float64NDArray
|
The simulation result array. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |