Skip to content

testsuite.simulators

Simulator functions run inside a SimulatorWorker.

Every function imports its simulator lazily, so a worker process loads only the simulator it is used for: roadrunner and libopencor bundle different LLVM versions and crash once both have compiled in the same process. Results are plain dictionaries (columns, rows) so they can be sent between processes.

simulate_sbml

simulate_sbml(
    sbml,
    selections,
    start,
    end,
    steps,
    relative_tolerance=None,
    absolute_tolerance=None,
    maximum_number_of_steps=None,
)

Uniform timecourse of an SBML model with roadrunner.

Parameters:

Name Type Description Default
sbml str

SBML document as string.

required
selections list[str]

roadrunner selections after time, e.g. S1, [S1].

required
start float

start time.

required
end float

end time.

required
steps int

number of intervals, the result has steps + 1 rows.

required
relative_tolerance float | None

relative tolerance of the integrator, the roadrunner default when None.

None
absolute_tolerance float | None

absolute tolerance of the integrator, the roadrunner default when None.

None
maximum_number_of_steps int | None

internal steps of the integrator between two time points, the roadrunner default (20000) when None.

None

Returns:

Type Description
dict[str, Any]

columns (the selections with time first) and rows.

simulate_cellml

simulate_cellml(
    cellml_path,
    start,
    end,
    steps,
    relative_tolerance=None,
    absolute_tolerance=None,
    maximum_number_of_steps=None,
)

Uniform timecourse of a CellML model with libopencor.

Parameters:

Name Type Description Default
cellml_path str

path of the CellML file.

required
start float

start time.

required
end float

end time.

required
steps int

number of intervals.

required
relative_tolerance float | None

relative tolerance of the ODE solver, the libopencor default when None.

None
absolute_tolerance float | None

absolute tolerance of the ODE solver, the libopencor default when None.

None
maximum_number_of_steps int | None

internal steps of the ODE solver between two time points, the default of run_timecourse when None.

None

Returns:

Type Description
dict[str, Any]

columns (time first, then every variable) and rows.

sleep

sleep(seconds)

Sleep, for the timeout tests of the worker.

Parameters:

Name Type Description Default
seconds float

how long.

required

Returns:

Type Description
dict[str, Any]

slept with the seconds.