amici.de_model_components
Objects for AMICI’s internal differential equation model representation
Classes
|
An AlgebraicEquation defines an algebraic equation. |
|
An AlgebraicState defines an entity that is algebraically determined |
|
A conservation law defines the absolute the total amount of a (weighted) sum of states |
|
A Constant is a fixed variable in the model with respect to which sensitivities cannot be computed, abbreviated by |
|
A State variable defines an entity that evolves with time according to the provided time derivative, abbreviated by |
|
An Event defines either a SBML event or a root of the argument of a Heaviside function. |
|
An Event Observable links model simulations to event related experimental measurements, abbreviated by |
|
An Expression is a recurring elements in symbolic formulas. |
|
A LogLikelihood defines the distance between measurements and experiments for a particular observable. |
|
Loglikelihood for event observables regularization |
|
Loglikelihood for observables |
|
Loglikelihood for event observables |
|
Base class for model components |
|
An Observable links model simulations to experimental measurements, abbreviated by |
|
A Parameter is a free variable in the model with respect to which sensitivities may be computed, abbreviated by |
|
A Standard Deviation Sigma rescales the distance between simulations and measurements when computing residuals or objective functions, abbreviated by |
|
Standard deviation for observables |
|
Standard deviation for event observables |
|
Base class for differential and algebraic model states |
- class amici.de_model_components.AlgebraicEquation(identifier, value)[source]
An AlgebraicEquation defines an algebraic equation.
- __init__(identifier, value)[source]
Create a new AlgebraicEquation instance.
- Parameters:
value (
sympy.core.expr.Expr) – Formula of the algebraic equation, the solution is given byformula == 0
- get_id()
ModelQuantity identifier
- Return type:
- Returns:
identifier of the ModelQuantity
- get_val()
ModelQuantity value
- Return type:
- Returns:
value of the ModelQuantity
- set_val(val)
Set ModelQuantity value
- Returns:
value of the ModelQuantity
- class amici.de_model_components.AlgebraicState(identifier, name, init)[source]
An AlgebraicState defines an entity that is algebraically determined
- __init__(identifier, name, init)[source]
Create a new AlgebraicState instance.
- Parameters:
identifier (
sympy.core.symbol.Symbol) – unique identifier of the AlgebraicStatename (
str) – individual name of the AlgebraicState (does not need to be unique)init (
sympy.core.expr.Expr) – initial value of the AlgebraicState
- get_dx_rdata_dx_solver(state_id)
Returns the expression that allows computation of
dx_rdata_dx_solverfor this state, accounting for conservation laws.- Returns:
dx_rdata_dx_solver expression
- get_id()
ModelQuantity identifier
- Return type:
- Returns:
identifier of the ModelQuantity
- get_val()
ModelQuantity value
- Return type:
- Returns:
value of the ModelQuantity
- 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_val(val)
Set ModelQuantity value
- Returns:
value of the ModelQuantity
- class amici.de_model_components.ConservationLaw(identifier, name, value, coefficients, state_id)[source]
A conservation law defines the absolute the total amount of a (weighted) sum of states
- __init__(identifier, name, value, coefficients, state_id)[source]
Create a new ConservationLaw instance.
- Parameters:
identifier (
sympy.core.symbol.Symbol) – unique identifier of the ConservationLawname (
str) – individual name of the ConservationLaw (does not need to be unique)value (
sympy.core.expr.Expr) – formula (sum of states)coefficients (
dict[sympy.core.symbol.Symbol,sympy.core.expr.Expr]) – coefficients of the states in the sumstate_id (
sympy.core.symbol.Symbol) – identifier of the state that this conservation law replaces
- get_id()
ModelQuantity identifier
- Return type:
- Returns:
identifier of the ModelQuantity
- 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:
- Returns:
normalized coefficent of the state
- get_val()
ModelQuantity value
- Return type:
- Returns:
value of the ModelQuantity
- 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
- set_val(val)
Set ModelQuantity value
- Returns:
value of the ModelQuantity
- class amici.de_model_components.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.- __init__(identifier, name, value)[source]
Create a new Expression instance.
- Parameters:
identifier (
sympy.core.symbol.Symbol) – unique identifier of the Constantname (
str) – individual name of the Constant (does not need to be unique)value (
numbers.Number) – numeric value
- get_id()
ModelQuantity identifier
- Return type:
- Returns:
identifier of the ModelQuantity
- get_val()
ModelQuantity value
- Return type:
- Returns:
value of the ModelQuantity
- set_val(val)
Set ModelQuantity value
- Returns:
value of the ModelQuantity
- class amici.de_model_components.DifferentialState(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
- __init__(identifier, name, init, dt)[source]
Create a new State instance. Extends
ModelQuantity.__init__()bydt- Parameters:
identifier (
sympy.core.symbol.Symbol) – unique identifier of the statename (
str) – individual name of the state (does not need to be unique)init (
sympy.core.expr.Expr) – initial valuedt (
sympy.core.expr.Expr) – time derivative
- get_dx_rdata_dx_solver(state_id)
Returns the expression that allows computation of
dx_rdata_dx_solverfor 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:
- Returns:
free symbols
- get_id()
ModelQuantity identifier
- Return type:
- Returns:
identifier of the ModelQuantity
- get_val()
ModelQuantity value
- Return type:
- Returns:
value of the ModelQuantity
- get_x_rdata()
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.de_model_components.ConservationLaw) – linear sum of states that if added to this state remain constant over time- Return type:
- set_dt(dt)[source]
Sets the time derivative
- Parameters:
dt (
sympy.core.expr.Expr) – time derivative- Return type:
- set_val(val)
Set ModelQuantity value
- Returns:
value of the ModelQuantity
- class amici.de_model_components.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
hduring simulation and are needed to inform the solver about a discontinuity in either the right-hand side or the states themselves, causing a reinitialization of the solver.- __init__(identifier, name, value, state_update, initial_value=True)[source]
Create a new Event instance.
- Parameters:
identifier (
sympy.core.symbol.Symbol) – unique identifier of the Eventname (
str) – individual name of the Event (does not need to be unique)value (
sympy.core.expr.Expr) – formula for the root / trigger functionstate_update (
sympy.core.expr.Expr|None) – formula for the bolus function (None for Heaviside functions, zero vector for events without bolus)initial_value (
bool|None) – initial boolean value of the trigger function at t0. If set to False, events may trigger att==t0, otherwise not.
- get_id()
ModelQuantity identifier
- Return type:
- Returns:
identifier of the ModelQuantity
- get_initial_value()[source]
Return the initial value for the root function.
- Return type:
- Returns:
initial value formula
- get_trigger_time()[source]
Get the time at which the event triggers.
Only for events that trigger at a single fixed time-point.
- Return type:
- get_val()
ModelQuantity value
- Return type:
- Returns:
value of the ModelQuantity
- set_val(val)
Set ModelQuantity value
- Returns:
value of the ModelQuantity
- class amici.de_model_components.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
- __init__(identifier, name, value, event, measurement_symbol=None, transformation='lin')[source]
Create a new EventObservable instance.
- Parameters:
identifier (
sympy.core.symbol.Symbol) – SeeObservable.__init__().name (
str) – SeeObservable.__init__().value (
sympy.core.expr.Expr) – SeeObservable.__init__().transformation (
amici.import_utils.ObservableTransformation|None) – SeeObservable.__init__().event (
sympy.core.symbol.Symbol) – Symbolic identifier of the corresponding event.
- get_event()[source]
Get the symbolic identifier of the corresponding event.
- Return type:
- Returns:
symbolic identifier
- get_id()
ModelQuantity identifier
- Return type:
- Returns:
identifier of the ModelQuantity
- get_measurement_symbol()
- Return type:
- get_regularization_symbol()
- Return type:
- get_val()
ModelQuantity value
- Return type:
- Returns:
value of the ModelQuantity
- set_val(val)
Set ModelQuantity value
- Returns:
value of the ModelQuantity
- class amici.de_model_components.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.- __init__(identifier, name, value)[source]
Create a new Expression instance.
- Parameters:
identifier (
sympy.core.symbol.Symbol) – unique identifier of the Expressionname (
str) – individual name of the Expression (does not need to be unique)value (
sympy.core.expr.Expr) – formula
- get_id()
ModelQuantity identifier
- Return type:
- Returns:
identifier of the ModelQuantity
- get_val()
ModelQuantity value
- Return type:
- Returns:
value of the ModelQuantity
- set_val(val)
Set ModelQuantity value
- Returns:
value of the ModelQuantity
- class amici.de_model_components.LogLikelihoodRZ(identifier, name, value)[source]
Loglikelihood for event observables regularization
- __init__(identifier, name, value)
Create a new Expression instance.
- Parameters:
identifier (
sympy.core.symbol.Symbol) – unique identifier of the LogLikelihoodname (
str) – individual name of the LogLikelihood (does not need to be unique)value (
sympy.core.expr.Expr) – formula
- get_id()
ModelQuantity identifier
- Return type:
- Returns:
identifier of the ModelQuantity
- get_val()
ModelQuantity value
- Return type:
- Returns:
value of the ModelQuantity
- set_val(val)
Set ModelQuantity value
- Returns:
value of the ModelQuantity
- class amici.de_model_components.LogLikelihoodY(identifier, name, value)[source]
Loglikelihood for observables
- __init__(identifier, name, value)
Create a new Expression instance.
- Parameters:
identifier (
sympy.core.symbol.Symbol) – unique identifier of the LogLikelihoodname (
str) – individual name of the LogLikelihood (does not need to be unique)value (
sympy.core.expr.Expr) – formula
- get_id()
ModelQuantity identifier
- Return type:
- Returns:
identifier of the ModelQuantity
- get_val()
ModelQuantity value
- Return type:
- Returns:
value of the ModelQuantity
- set_val(val)
Set ModelQuantity value
- Returns:
value of the ModelQuantity
- class amici.de_model_components.LogLikelihoodZ(identifier, name, value)[source]
Loglikelihood for event observables
- __init__(identifier, name, value)
Create a new Expression instance.
- Parameters:
identifier (
sympy.core.symbol.Symbol) – unique identifier of the LogLikelihoodname (
str) – individual name of the LogLikelihood (does not need to be unique)value (
sympy.core.expr.Expr) – formula
- get_id()
ModelQuantity identifier
- Return type:
- Returns:
identifier of the ModelQuantity
- get_val()
ModelQuantity value
- Return type:
- Returns:
value of the ModelQuantity
- set_val(val)
Set ModelQuantity value
- Returns:
value of the ModelQuantity
- class amici.de_model_components.ModelQuantity(identifier, name, value)[source]
Base class for model components
- __init__(identifier, name, value)[source]
Create a new ModelQuantity instance.
- Parameters:
identifier (
sympy.core.symbol.Symbol) – unique identifier of the quantityname (
str) – individual name of the quantity (does not need to be unique)value (
typing.SupportsFloat|numbers.Number|sympy.core.expr.Expr) – either formula, numeric value or initial value
- class amici.de_model_components.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
- __init__(identifier, name, value, measurement_symbol=None, transformation=ObservableTransformation.LIN)[source]
Create a new Observable instance.
- Parameters:
identifier (
sympy.core.symbol.Symbol) – unique identifier of the Observablename (
str) – individual name of the Observable (does not need to be unique)value (
sympy.core.expr.Expr) – formulatransformation (
None|amici.import_utils.ObservableTransformation) – observable transformation, only applies when evaluating objective function or residuals
- get_id()
ModelQuantity identifier
- Return type:
- Returns:
identifier of the ModelQuantity
- get_val()
ModelQuantity value
- Return type:
- Returns:
value of the ModelQuantity
- set_val(val)
Set ModelQuantity value
- Returns:
value of the ModelQuantity
- class amici.de_model_components.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.- __init__(identifier, name, value)[source]
Create a new Expression instance.
- Parameters:
identifier (
sympy.core.symbol.Symbol) – unique identifier of the Parametername (
str) – individual name of the Parameter (does not need to be unique)value (
numbers.Number) – numeric value
- get_id()
ModelQuantity identifier
- Return type:
- Returns:
identifier of the ModelQuantity
- get_val()
ModelQuantity value
- Return type:
- Returns:
value of the ModelQuantity
- set_val(val)
Set ModelQuantity value
- Returns:
value of the ModelQuantity
- class amici.de_model_components.SigmaY(identifier, name, value)[source]
Standard deviation for observables
- __init__(identifier, name, value)
Create a new Standard Deviation instance.
- Parameters:
identifier (
sympy.core.symbol.Symbol) – unique identifier of the Standard Deviationname (
str) – individual name of the Standard Deviation (does not need to be unique)value (
sympy.core.expr.Expr) – formula
- get_id()
ModelQuantity identifier
- Return type:
- Returns:
identifier of the ModelQuantity
- get_val()
ModelQuantity value
- Return type:
- Returns:
value of the ModelQuantity
- set_val(val)
Set ModelQuantity value
- Returns:
value of the ModelQuantity
- class amici.de_model_components.SigmaZ(identifier, name, value)[source]
Standard deviation for event observables
- __init__(identifier, name, value)
Create a new Standard Deviation instance.
- Parameters:
identifier (
sympy.core.symbol.Symbol) – unique identifier of the Standard Deviationname (
str) – individual name of the Standard Deviation (does not need to be unique)value (
sympy.core.expr.Expr) – formula
- get_id()
ModelQuantity identifier
- Return type:
- Returns:
identifier of the ModelQuantity
- get_val()
ModelQuantity value
- Return type:
- Returns:
value of the ModelQuantity
- set_val(val)
Set ModelQuantity value
- Returns:
value of the ModelQuantity
- class amici.de_model_components.State(identifier, name, value)[source]
Base class for differential and algebraic model states
- __init__(identifier, name, value)
Create a new ModelQuantity instance.
- Parameters:
identifier (
sympy.core.symbol.Symbol) – unique identifier of the quantityname (
str) – individual name of the quantity (does not need to be unique)value (
typing.SupportsFloat|numbers.Number|sympy.core.expr.Expr) – either formula, numeric value or initial value
- get_dx_rdata_dx_solver(state_id)[source]
Returns the expression that allows computation of
dx_rdata_dx_solverfor this state, accounting for conservation laws.- Returns:
dx_rdata_dx_solver expression
- get_id()
ModelQuantity identifier
- Return type:
- Returns:
identifier of the ModelQuantity
- get_val()
ModelQuantity value
- Return type:
- Returns:
value of the ModelQuantity
- get_x_rdata()[source]
Returns the expression that allows computation of x_rdata for this state, accounting for conservation laws.
- Returns:
x_rdata expression
- abstract has_conservation_law()[source]
Checks whether this state has a conservation law assigned.
- Returns:
True if assigned, False otherwise
- set_val(val)
Set ModelQuantity value
- Returns:
value of the ModelQuantity