Skip to content

forward

The local sensitivities of a simulation from the forward sensitivities.

local of sbmlsim.sensitivity.indices takes central differences of the points of a sampling.local design: two simulations per parameter, whose difference is accurate to the step of the design and to the error of the integrations it takes the difference of. forward reads the derivatives the sbmlsim-core integrated along with the states instead (CVODES, CV_STAGGERED, Simulator.sensitivities): one simulation of k parameters answers what 2 k + 1 simulations of a design answer, with no step to choose and to the tolerance of the integration.

The indices are the ones of local, raw and normalized, over (parameter, time):

  • raw is dy/dp at every output time, in the unit of the selection per unit of the parameter;
  • normalized is d ln y / d ln p, dy/dp * p / y, dimensionless, NaN where the selection is zero at a time point.

p is the value of the parameter at the start of the simulation, which the run delivers as a column of its own, so a pre-initialization of the simulation or a change of the model is the reference the indices are normalized by.

What it does not do, and local does: the derivatives are the ones of the selections of the model, not of the observables of a scan, since the derivative of a reduction (max, the parameters of a PK analysis) is not one of the engine; and only sbmlsim-core carries them, for a simulation of one interval without changes, without a presimulation and of a model without events (the engine refuses the others). The central differences of a design remain the general path.

A parameter which enters the model as an exponent of a state which reaches zero, e.g. the Hill coefficient of a repressilator, has no finite derivative there and the integration of the sensitivities fails: such a parameter is one for a difference of simulations and not for this path.

forward

forward(
    simulator,
    model,
    simulation,
    parameters,
    *,
    selections=None,
)

Compute the local sensitivities of a simulation exactly, see the module.

Parameters:

Name Type Description Default
simulator Simulator

the simulator, of sbmlsim-core (Simulator(engine="core")).

required
model ModelLike

the model, see Simulator.load.

required
simulation Simulation | Plan

the simulation or a plan of it; its output times are the time points of the indices, so a simulation of times= or steps= gives a grid and one of the steps of the integrator gives its steps.

required
parameters Sequence[str]

the ids the derivatives are taken in, in their order: a parameter of the model, a compartment, or a species as its amount (S) or its concentration ([S]).

required
selections Sequence[str] | None

the selections the indices are computed for, the ones of the model by default.

None

Returns:

Type Description
SensitivityResult

The indices raw and normalized of every selection over

SensitivityResult

(parameter, time).

Raises:

Type Description
ValueError

if the simulation does not fit the model, no parameter is given, or a parameter or a selection is not one of the model.

NotImplementedError

if the simulator is not of sbmlsim-core, or for a simulation or a model whose sensitivities the engine does not carry.

RuntimeError

if the engine fails to integrate.