Skip to content

Commit ac418ba

Browse files
committed
evaluate / simplify
1 parent 73ec65a commit ac418ba

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

python/sdist/amici/import_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,8 @@ def _parse_heaviside_trigger(trigger: sp.Expr) -> sp.Expr:
509509
:param trigger:
510510
:return: real valued root function expression
511511
"""
512+
trigger = trigger.simplify()
513+
512514
if trigger.is_Relational:
513515
root = trigger.args[0] - trigger.args[1]
514516
_check_unsupported_functions(root, "sympy.Expression")

python/sdist/amici/sbml_import.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ def __init__(
199199
sbml_version=self.sbml.getVersion(),
200200
symbol_kwargs={"real": True},
201201
ignore_units=True,
202+
evaluate=True,
202203
)
203204

204205
@log_execution_time("loading SBML", logger)
@@ -2892,10 +2893,6 @@ def _sympy_from_sbml_math(
28922893
"contains an unsupported expression: "
28932894
f"{err}."
28942895
)
2895-
# SBML math is currently parsed with evaluate=False, causing
2896-
# some problems that are solved by .simplify(), e.g.,
2897-
# evaluating constant piecewise conditions
2898-
expr = expr.simplify()
28992896
# replace special time object by `sbml_time_symbol`
29002897
# which will later be replaced by `amici_time_symbol`
29012898
expr = expr.replace(TimeSymbol, lambda *args: sbml_time_symbol)

0 commit comments

Comments
 (0)