amici.ode_model

Objects for AMICI’s internal ODE model representation

Classes

ConservationLaw(identifier, name, value, ...)

A conservation law defines the absolute the total amount of a (weighted) sum of states

Constant(identifier, name, value)

A Constant is a fixed variable in the model with respect to which sensitivities cannot be computed, abbreviated by k.

Event(identifier, name, value, state_update)

An Event defines either a SBML event or a root of the argument of a Heaviside function.

EventObservable(identifier, name, value, event)

An Event Observable links model simulations to event related experimental measurements, abbreviated by z.

Expression(identifier, name, value)

An Expression is a recurring elements in symbolic formulas.

LogLikelihood(identifier, name, value)

A LogLikelihood defines the distance between measurements and experiments for a particular observable.

LogLikelihoodRZ(identifier, name, value)

Loglikelihood for event observables regularization

LogLikelihoodY(identifier, name, value)

Loglikelihood for observables

LogLikelihoodZ(identifier, name, value)

Loglikelihood for event observables

ModelQuantity(identifier, name, value)

Base class for model components

Observable(identifier, name, value[, ...])

An Observable links model simulations to experimental measurements, abbreviated by y.

Parameter(identifier, name, value)

A Parameter is a free variable in the model with respect to which sensitivities may be computed, abbreviated by p.

Sigma(identifier, name, value)

A Standard Deviation Sigma rescales the distance between simulations and measurements when computing residuals or objective functions, abbreviated by sigma{y,z}.

SigmaY(identifier, name, value)

Standard deviation for observables

SigmaZ(identifier, name, value)

Standard deviation for event observables

State(identifier, name, init, dt)

A State variable defines an entity that evolves with time according to the provided time derivative, abbreviated by x.

class amici.ode_model.ConservationLaw(identifier, name, value, coefficients, state_id)[source]

A conservation law defines the absolute the total amount of a (weighted) sum of states

get_ncoeff(state_id)[source]

Computes the normalized coefficient a_i/a_j where i is the index of the provided state_id and j is the index of the state that is replaced by this conservation law. This can be used to compute both dtotal_cl/dx_rdata (=ncoeff) and dx_rdata/dx_solver (=-ncoeff).

Parameters

state_id – identifier of the state

Return type

typing.Union[sympy.core.expr.Expr, int, float]

Returns

normalized coefficent of the state

get_x_rdata()[source]

Returns the expression that allows computation of x_rdata for the state that this conservation law replaces.

Returns

x_rdata expression

class amici.ode_model.Constant(identifier, name, value)[source]

A Constant is a fixed variable in the model with respect to which sensitivities cannot be computed, abbreviated by k.

class amici.ode_model.Event(identifier, name, value, state_update, initial_value=True)[source]

An Event defines either a SBML event or a root of the argument of a Heaviside function. The Heaviside functions will be tracked via the vector h during simulation and are needed to inform the ODE solver about a discontinuity in either the right-hand side or the states themselves, causing a reinitialization of the solver.

get_initial_value()[source]

Return the initial value for the root function.

Return type

bool

Returns

initial value formula

class amici.ode_model.EventObservable(identifier, name, value, event, measurement_symbol=None, transformation='lin')[source]

An Event Observable links model simulations to event related experimental measurements, abbreviated by z.

Variables

_event – symbolic event identifier

get_event()[source]

Get the symbolic identifier of the corresponding event.

Return type

sympy.core.symbol.Symbol

Returns

symbolic identifier

class amici.ode_model.Expression(identifier, name, value)[source]

An Expression is a recurring elements in symbolic formulas. Specifying this may yield more compact expression which may lead to substantially shorter model compilation times, but may also reduce model simulation time. Abbreviated by w.

class amici.ode_model.LogLikelihoodRZ(identifier, name, value)[source]

Loglikelihood for event observables regularization

class amici.ode_model.LogLikelihoodY(identifier, name, value)[source]

Loglikelihood for observables

class amici.ode_model.LogLikelihoodZ(identifier, name, value)[source]

Loglikelihood for event observables

class amici.ode_model.ModelQuantity(identifier, name, value)[source]

Base class for model components

get_id()[source]

ModelQuantity identifier

Return type

sympy.core.symbol.Symbol

Returns

identifier of the ModelQuantity

get_name()[source]

ModelQuantity name

Return type

str

Returns

name of the ModelQuantity

get_val()[source]

ModelQuantity value

Return type

sympy.core.expr.Expr

Returns

value of the ModelQuantity

set_val(val)[source]

Set ModelQuantity value

Returns

value of the ModelQuantity

class amici.ode_model.Observable(identifier, name, value, measurement_symbol=None, transformation=ObservableTransformation.LIN)[source]

An Observable links model simulations to experimental measurements, abbreviated by y.

Variables
  • _measurement_symbol – sympy symbol used in the objective function to represent measurements to this observable

  • trafo – observable transformation, only applies when evaluating objective function or residuals

get_measurement_symbol()[source]
Return type

sympy.core.symbol.Symbol

get_regularization_symbol()[source]
Return type

sympy.core.symbol.Symbol

class amici.ode_model.Parameter(identifier, name, value)[source]

A Parameter is a free variable in the model with respect to which sensitivities may be computed, abbreviated by p.

class amici.ode_model.SigmaY(identifier, name, value)[source]

Standard deviation for observables

class amici.ode_model.SigmaZ(identifier, name, value)[source]

Standard deviation for event observables

class amici.ode_model.State(identifier, name, init, dt)[source]

A State variable defines an entity that evolves with time according to the provided time derivative, abbreviated by x.

Variables
  • _conservation_law – algebraic formula that allows computation of this state according to a conservation law

  • _dt – algebraic formula that defines the temporal derivative of this state

get_dt()[source]

Gets the time derivative

Return type

sympy.core.expr.Expr

Returns

time derivative

get_dx_rdata_dx_solver(state_id)[source]

Returns the expression that allows computation of dx_rdata_dx_solver for this state, accounting for conservation laws.

Returns

dx_rdata_dx_solver expression

get_free_symbols()[source]

Gets the set of free symbols in time derivative and initial conditions

Return type

typing.Set[sympy.core.basic.Basic]

Returns

free symbols

get_x_rdata()[source]

Returns the expression that allows computation of x_rdata for this state, accounting for conservation laws.

Returns

x_rdata expression

has_conservation_law()[source]

Checks whether this state has a conservation law assigned.

Returns

True if assigned, False otherwise

set_conservation_law(law)[source]

Sets the conservation law of a state.

If a conservation law is set, the respective state will be replaced by an algebraic formula according to the respective conservation law.

Parameters

law (amici.ode_model.ConservationLaw) – linear sum of states that if added to this state remain constant over time

Return type

None

set_dt(dt)[source]

Sets the time derivative

Parameters

dt (sympy.core.expr.Expr) – time derivative

Return type

None