Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl committed Feb 22, 2024
1 parent 1697b18 commit bbdacd7
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions python/sdist/amici/sbml_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ def _gather_base_locals(
"INF": sp.oo,
"NaN": sp.nan,
"rem": sp.Mod,
"time": symbol_with_assumptions("time"),
"time": sbml_time_symbol,
# SBML L3 explicitly defines this value, which is not equal
# to the most recent SI definition.
"avogadro": sp.Float(6.02214179e23),
Expand Down Expand Up @@ -1096,11 +1096,14 @@ def _process_parameters(

# Parameters that need to be turned into expressions
# so far, this concerns parameters with symbolic initial assignments
# (those have been skipped above)
# (those have been skipped above) that are not rate rule targets
for par in self.sbml.getListOfParameters():
if (
ia := self._get_element_initial_assignment(par.getId())
) is not None and not ia.is_Number:
(ia := self._get_element_initial_assignment(par.getId()))
is not None
and not ia.is_Number
and not self.is_rate_rule_target(par)
):
self.symbols[SymbolId.EXPRESSION][
_get_identifier_symbol(par)
] = {
Expand Down Expand Up @@ -1875,7 +1878,9 @@ def _process_initial_assignments(self):
for ia in self.sbml.getListOfInitialAssignments():
identifier = _get_identifier_symbol(ia)
if identifier in itt.chain(
self.symbols[SymbolId.SPECIES], self.compartments
self.symbols[SymbolId.SPECIES],
self.compartments,
self.symbols[SymbolId.EXPRESSION],
):
continue

Expand Down Expand Up @@ -1949,9 +1954,7 @@ def _make_initial(
if "init" in species:
sym_math = smart_subs(sym_math, species_id, species["init"])

sym_math = smart_subs(
sym_math, self._local_symbols["time"], sp.Float(0)
)
sym_math = smart_subs(sym_math, sbml_time_symbol, sp.Float(0))

sym_math = _dummy_to_rateof(sym_math, rateof_to_dummy)

Expand Down

0 comments on commit bbdacd7

Please sign in to comment.