Models#
A model in symident is a set of ordinary differential equations with observables, together
with the experimental conditions, events and inputs under which it is observed. As running
example we consider a precursor x1 that is made basally and on a stimulus u, and that
becomes the observed product x2 or is degraded. From rest, u switches on at
\(t = 0\) with one of two doses:
The coordinates of a model are the quantities whose identifiability is decided: the
estimated parameters, here kb, kin, k1, kl, k2 and s, and the initial
values that neither the model nor trafo fixes, the free initial values. Symbols listed in
fixed are known; they take generic values, i.e., values outside a set of measure zero,
random values in the computation.
Reaction networks and ODEs#
symident.Model takes either a reaction network, i.e., species, a stoichiometry with
one row per reaction, and rate expressions, or the ODEs directly. Both give the same model:
import symident as si
m = si.Model(reactions={"species": ["x1", "x2", "u"],
"stoichiometry": [[1, 0, 0], [1, 0, 0], [-1, 1, 0],
[-1, 0, 0], [0, -1, 0]],
"rates": ["kb", "kin*u", "k1*x1", "kl*x1", "k2*x2"]},
observables={"y": "s*x2"},
inputs=["u"],
events=[{"var": "u", "time": 0, "value": "dose", "method": "replace"}],
conditions={"rows": ["low", "high"], "cols": {"dose": [1, 10]}})
The input u is zero at rest until the event sets it. As ODEs the same model reads
m = si.Model({"x1": "kb + kin*u - (k1 + kl)*x1", "x2": "k1*x1 - k2*x2", "u": "0"},
{"y": "s*x2"},
inputs=["u"],
events=[{"var": "u", "time": 0, "value": "dose", "method": "replace"}],
conditions={"rows": ["low", "high"], "cols": {"dose": [1, 10]}})
Arguments#
The further arguments of Model describe how the model is observed:
inputsinput states, i.e., inputs that events set, as
uabove; they are zero at the start and at rest.unknown_inputs,known_inputsunknown functions of time, and recorded functions of time of no assumed form (Unknown and known inputs).
eventsdicts with
var,time,valueandmethod(replace,addormultiply).rootin place oftimefires where an expression changes sign, andcondlists the conditions, by their index from zero, in which the event occurs; by default it occurs in all.conditionsthe condition grid, one row per condition, i.e., per experiment, as
{"rows": [...], "cols": {name: [values]}}or a data frame. A number fixes a symbol, and a string replaces it by an expression or another name. A column named like a state gives the initial value of that state. Free initial values are shared between conditions unless the grid ortrafosets them.trafoa parameter transformation, i.e., a dict of expressions by symbol; an entry named like a state sets its initial value. A list gives one dict per condition and must have as many entries as the grid has rows.
fixedknown symbols; they take generic values and are no coordinates.
parametersfurther symbols treated as parameters; the coordinates stay the same.
totalsconserved totals, name to expression, which the right-hand sides must conserve; a coefficient may hold parameters, such as the volumes in
V1*A + V2*B. When they are omitted, they are computed from the linear conservation laws, from the stoichiometry ofreactionsor from the right-hand sides of the ODEs, and namedtotal1,total2, …. These are nonnegative combinations where such combinations span the laws, the same for every order of the states.reduce_cqeliminates one species per total (Detection).equilibrate,positive,reduce_cqdefaults for
detect(), which a call can override; not given, they areFalse,TrueandFalse.
Expression language#
Expressions use +, -, *, /, powers (^ or **) and the following
functions:
Exponential and logarithm |
|
Roots and powers |
|
Trigonometric |
|
Hyperbolic |
|
Switches |
|
The language is that of cppDE (?cppDE::expressions), with the following conventions:
acot(x)isatan(1/x), and likewise for the other inverse reciprocal functions.piis π and cannot name a symbol;Eis a name,exp(1)is Euler’s number, andtimeis the clock.Logarithms, roots, fractional powers and bases of free exponents are real for a positive argument. The detection takes generic values and needs no sign; an argument that the
positivecoordinates do not make positive is named ininfo["limits"].A rational power is written as a fraction,
x^(1/2), not asx^0.5.floor,ceilingandroundare refused; their steps are written withpiecewise().Other functions, such as
erfanderfc, needengine="symbolic", which accepts every SymPy function but suits small models only. Requests for further functions are welcome at dModverse/symident#issues.