Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions python/amici/sbml_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,15 +459,6 @@ def _gather_base_locals(self):

self.add_local_symbol(c.getId(), _get_identifier_symbol(c))

for r in self.sbml.getListOfRules():
if not isinstance(self.sbml.getElementBySId(r.getVariable()),
sbml.SpeciesReference) \
or self._sympy_from_sbml_math(r) is None:
continue

self.add_local_symbol(r.getVariable(),
symbol_with_assumptions(r.getVariable()))

for r in self.sbml.getListOfReactions():
for e in itt.chain(r.getListOfReactants(), r.getListOfProducts()):
if not (e.isSetId() and e.isSetStoichiometry()) or \
Expand Down Expand Up @@ -505,8 +496,13 @@ def add_local_symbol(self, key: str, value: sp.Expr):
if key in itt.chain(self._local_symbols.keys(),
['True', 'False', 'pi']):
raise SBMLException(
'AMICI does not support SBML models containing '
f'variables with SId {key}.'
f'AMICI tried to add a local symbol {key} with value {value}, '
f'but {key} was already instantiated with '
f'{self._local_symbols[key]}. This means either that there '
f'are multiple SBML element with SId {key}, which is '
f'invalid SBML, or that the employed SId {key} is a special '
'reserved symbol in AMICI. This can be fixed by renaming '
f'the element with SId {key}.'
)
self._local_symbols[key] = value

Expand Down