From 91b3afc06cada6153445a0173946a794c9fe8c84 Mon Sep 17 00:00:00 2001 From: Lucian Smith Date: Fri, 18 Oct 2024 16:24:03 -0700 Subject: [PATCH 1/2] Fix export of constant variables. --- biosimulators_pysces/core.py | 8 ++++---- tests/test_core_main.py | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/biosimulators_pysces/core.py b/biosimulators_pysces/core.py index 84e1ce0..c90cc81 100644 --- a/biosimulators_pysces/core.py +++ b/biosimulators_pysces/core.py @@ -25,6 +25,7 @@ from kisao.utils import get_preferred_substitute_algorithm_by_ids from kisao.warnings import AlgorithmSubstitutedWarning import lxml.etree +import numpy import os import pysces import tempfile @@ -160,13 +161,12 @@ def exec_sed_task(task, variables, preprocessed_task=None, log=None, config=None variable_results_model_attr_map = preprocessed_task['model']['variable_results_model_attr_map'] for variable in variables: label = variable_results_model_attr_map[(variable.target, variable.symbol)] - index = labels.index(label) - if index is not None: + if label in labels: + index = labels.index(label) variable_results[variable.id] = results[:, index][-(sim.number_of_points + 1):] else: - raise ValueError("No variable " + variable.id + " found in simulation output.") - # variable_results[variable.id] = numpy.full((sim.number_of_points + 1,), getattr(model, model_attr_name)) + variable_results[variable.id] = numpy.full((sim.number_of_points + 1,), getattr(model, label)) # log action if config.LOG: diff --git a/tests/test_core_main.py b/tests/test_core_main.py index 0ebf0f7..1582738 100644 --- a/tests/test_core_main.py +++ b/tests/test_core_main.py @@ -91,6 +91,12 @@ def test_exec_sed_task_successfully(self): target="/sbml:sbml/sbml:model/sbml:listOfSpecies/sbml:species[@id='IL']", target_namespaces=self.NAMESPACES, task=task), + sedml_data_model.Variable( + id='kf0', + target="/sbml:sbml/sbml:model/sbml:listOfParameters/sbml:parameter[@id='kf_0']", + target_namespaces=self.NAMESPACES, + task=task, + ), ] variable_results, _ = core.exec_sed_task(task, variables) From fe11267e81f1df4a8b87899cb21c72dac157edc4 Mon Sep 17 00:00:00 2001 From: Lucian Smith Date: Fri, 18 Oct 2024 16:25:16 -0700 Subject: [PATCH 2/2] Update version number. --- biosimulators_pysces/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/biosimulators_pysces/_version.py b/biosimulators_pysces/_version.py index 8dcfa7d..c2bb26a 100644 --- a/biosimulators_pysces/_version.py +++ b/biosimulators_pysces/_version.py @@ -1 +1 @@ -__version__ = '0.1.32' +__version__ = '0.1.33'