diff --git a/python/sdist/amici/sbml_import.py b/python/sdist/amici/sbml_import.py index dcff20a3f9..1ac2d6a4cc 100644 --- a/python/sdist/amici/sbml_import.py +++ b/python/sdist/amici/sbml_import.py @@ -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), @@ -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) ] = { @@ -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 @@ -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)