Skip to content

timecourse

The timecourse of a roadrunner model which is simulated in parts.

A model of a tissue (the tissue and perfusion models of pkdb_models, a zonated liver) is often simulated in parts: a part sets values of the model at its start (a perfusion, a substrate, a switch) and runs for its duration, the next part continues from the state in which the part before ends. A Simulation is the list of its parts, run_simulation runs them one after the other and returns one timecourse whose time continues over the parts.

The parts run on a roadrunner instance of the model directly, without the experiments of sbmlsim: the model is loaded, its tolerances and its selections are set by the script which runs it.

SimPart dataclass

SimPart(tend, changes, steps)

A part of a simulation.

Attributes:

Name Type Description
tend float

the duration of the part, in the time unit of the model.

changes dict[str, float]

the values the part sets at its start, by the selection of roadrunner ("[S_ext]" for a concentration, "S_ext" for an amount or a parameter).

steps int

the number of steps of the timecourse of the part; the timecourse has steps + 1 points, its start and its end included.

Simulation dataclass

Simulation(sid, title, parts)

A simulation of parts which run one after the other.

Attributes:

Name Type Description
sid str

the id of the simulation, e.g. the key of its results.

title str

the title of the simulation, e.g. of its figures.

parts list[SimPart]

the parts, in the order in which they run.

run_simulation

run_simulation(r, sim)

Run the parts of a simulation and concatenate their timecourses.

The model is reset (resetAll) before the first part, so that a simulation does not depend on the simulations before it. A part sets its changes and simulates from the state in which the part before ends; the time of its timecourse continues the time of the part before, so the last point of a part and the first point of the next part have the same time (the state before and after the changes). The columns are the timeCourseSelections of r.

Parameters:

Name Type Description Default
r RoadRunner

the roadrunner instance of the model.

required
sim Simulation

the simulation.

required

Returns:

Type Description
DataFrame

The timecourse of the simulation, the timecourses of its parts one

DataFrame

after the other (the index of each part starts at 0).