Skip to content

Commit

Permalink
SBML import: Evaluate initial assignments (#2359)
Browse files Browse the repository at this point in the history
Evaluate initial assignments to parameters to determine whether the targets are amici parameters or expressions. Related to #2304.

For example, it the initial assignment is `log(10)`, this should still be a parameter instead of an expression, but `sympy.log(10).is_Number` will be `False`.
  • Loading branch information
dweindl authored Mar 6, 2024
1 parent 536a68e commit 19f7baf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion python/sdist/amici/sbml_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,12 @@ def _process_parameters(

# parameter ID => initial assignment sympy expression
par_id_to_ia = {
par.getId(): ia
par.getId(): ia.subs(
{
BooleanTrue(): sp.Float(1.0),
BooleanFalse(): sp.Float(0.0),
}
).evalf()
for par in self.sbml.getListOfParameters()
if (ia := self._get_element_initial_assignment(par.getId()))
is not None
Expand Down

0 comments on commit 19f7baf

Please sign in to comment.