ode2sbml.parser
parser
Parser for Python ODE functions → ODEModel IR.
Supports three input conventions: A: scipy-style function (ast-parsed) B: dict-of-formulas style C: SymPy symbolic system
from_function(func, state_vars, param_names, initial_conditions, parameter_values, parameter_units=None, compartment='cell', compartment_size=1.0, model_id='model', model_name='ODE Model', notes='')
Parse a scipy-style ODE function into an :class:ODEModel.
The function must have signature func(t, y, p) or func(t, y)
where y is the state vector and p is the parameter vector.
Source code in ode2sbml/parser.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
from_dict(model_dict, model_id='model', model_name='ODE Model', notes='')
Parse a dict-of-formulas specification into an :class:ODEModel.
Expected keys:
- species: {name: initial_value}
- parameters: {name: value}
- odes: {species_name: formula_string}
- compartments: {name: size} (optional, defaults to {"cell": 1.0})
- assignment_rules: {name: formula_string} (optional)
- events: list of {trigger, assignments, delay} (optional)
Source code in ode2sbml/parser.py
from_sympy(odes, params, inits, compartment='cell', compartment_size=1.0, species_units=None, parameter_units=None, model_id='model', model_name='ODE Model', assignment_rules=None, events=None, notes='')
Parse a SymPy symbolic ODE system into an :class:ODEModel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
odes
|
Dict[Symbol, Expr]
|
Mapping from species symbol to its rate expression. |
required |
params
|
Dict[Symbol, float]
|
Mapping from parameter symbol to its nominal value. |
required |
inits
|
Dict[Symbol, float]
|
Mapping from species symbol to initial condition. |
required |