From d0a12c4290169d134744ffa15f5cf61e8776849a Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Wed, 17 May 2023 18:51:39 +0200 Subject: [PATCH] SBML import - faster _get_list_of_species_references (#2094) --- python/sdist/amici/sbml_import.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/python/sdist/amici/sbml_import.py b/python/sdist/amici/sbml_import.py index 812a4f8c27..39b7b64ed5 100644 --- a/python/sdist/amici/sbml_import.py +++ b/python/sdist/amici/sbml_import.py @@ -2535,11 +2535,11 @@ def _get_list_of_species_references( ListOfSpeciesReferences """ return [ - reference - for element in sbml_model.all_elements - if isinstance(element, sbml.ListOfSpeciesReferences) - for reference in element - ] + reference + for reaction in sbml_model.getListOfReactions() + for reference in + itt.chain(reaction.getListOfReactants(), reaction.getListOfProducts(), reaction.getListOfModifiers()) + ] def replace_logx(math_str: Union[str, float, None]) -> Union[str, float, None]: