Input conventions
ode2sbml supports three input conventions.
Convention A: scipy-style RHS function
Required structure:
state_vars = ["x"]
param_names = ["k"]
initial_conditions = {"x": 1.0}
parameter_values = {"k": 0.2}
def model(t, y, p):
x = y[0]
k = p[0]
dx = -k * x
return [dx]
Use this when your model already exists as simulation code.
AST parsing limitations
Convention A depends on static parsing of assignments and return values. Dynamic derivative construction is not a good fit.
Convention B: dict-of-formulas
Required keys:
Optional keys:
Use this for transparent, version-control-friendly model files.
Convention C: SymPy symbolic system
Required module-level variables:
Use this when symbolic manipulation is part of your workflow.
Selection guide
| Use case | Recommended convention |
|---|---|
| Existing scipy simulation function | A |
| Documentation, tests, reproducible examples | B |
| Symbolic derivation or simplification | C |
| Large curated models | B or direct ODEModel construction |