simulator.executor¶
The executor runs a plan on roadrunner.
The semantics are the ones of PEtab v2:
- The model is initialized with the pre-initialization values, see
RoadrunnerSBMLModel.initialize: the initial assignments follow a changed parameter, and nothing of an earlier simulation is left. - A presimulation integrates until the rates of change vanish.
- The interval is split at the times of the events. At the start of a segment the events of its time are applied: every value is evaluated first, with the state at that time, then every target is set; a compartment keeps the concentration of the concentration species in it.
- After a change at a time after the start, the events whose triggers the change made true fire, which roadrunner does not see.
- A segment is integrated with the output of the plan and ends in its
state at its end, which the next change is applied to; for the steps of
the integrator see
_steps, which has an event of the model as two rows at the time of the event, the states before and after it, whatever the first integration of the process was, seesbmlsim.model.roottol. A change after the start, the one at the end included, has two rows at its time in the output, the state before the change, which ends the segment before it, and the state after it, which starts the next one: the steps of the integrator at every change, an output of times at its times which are changes. A segment of a model with events stops just before its end, a unit in the last place of the larger magnitude of its start and end and at least four machine epsilons, see_stopand_simulate_times, so an event of the model at the time of a change fires after the change and an event at the end after the state before it. A segment too short for CVODE, a few units in the last place in absolute time, is not integrated: its state is the one at its start, and the triggers before the next change are evaluated at the time the model is at, its start, so an event of the time in it fires once, after it, see_integrable. - An event of the model within the resolution of the time after the end is
at the end, see
_event_at_the_end: the steps of the integrator have it as two rows, the states before and after it, an output time at the end the state after it, as a time of a grid at an event, and it fires after a change at the end. The steady state after the end starts after it. An event within the resolution before the end is in the chain at the end, whose rows are the state after it, as at a change. An event whose trigger becomes true within the rounding of the state one unit in the last place before the end, e.g.X >= 1ofX' = 1from 0 at the end 1, fires before it, and the end has the state after it. - A model which does not read the time (
ModelSymbols.time_dependent) is integrated in local time: every segment starts at the time 0 of roadrunner and its output is shifted back, so the first step of CVODE after a change is never below the resolution of the time. A model which reads the time is integrated in absolute time.
The executor uses no pint, no deepcopy, no xarray and no pandas: it is what an evaluation of the objective of a fit runs.
SteadyStateError
¶
Bases: RuntimeError
A presimulation did not reach a steady state.
execute
¶
Run a plan on a loaded model.
The output has two rows at the time of a change after the start, the state before the change and the state after it, and the steps of the integrator have two at an event of the model at the end, see the module.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plan
|
Plan
|
the plan, compiled against the model. |
required |
model
|
RoadrunnerSBMLModel
|
the loaded model. |
required |
selections
|
Sequence[str]
|
the columns of the result, |
required |
Returns:
| Type | Description |
|---|---|
TimecourseResult
|
The result, with the time shifted by |
Raises:
| Type | Description |
|---|---|
SteadyStateError
|
if the presimulation does not reach a steady state. |
RuntimeError
|
if roadrunner fails to integrate. |
steady_state
¶
Integrate a model until its rates of change vanish.
The model is integrated with the steps of the integrator over horizons
which grow by a factor of ten, from start, until
|dx/dt| <= absolute_tolerance + relative_tolerance * |x| for every
state, events active. Every horizon ends in the state at its end, see
_to_the_end.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
RoadrunnerSBMLModel
|
the model in the state the integration starts from. |
required |
plan
|
SteadyStatePlan
|
the steady state. |
required |
start
|
float
|
the time the integration starts at. |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
The time the steady state was reached at. |
Raises:
| Type | Description |
|---|---|
SteadyStateError
|
if the steady state is not reached by |