Skip to content

Commit

Permalink
Merge pull request #9 from biosimulators/fix-const-param-export
Browse files Browse the repository at this point in the history
Fix constant parameter export
  • Loading branch information
luciansmith authored Oct 18, 2024
2 parents bf79124 + fe11267 commit 4c20373
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion biosimulators_pysces/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.1.32'
__version__ = '0.1.33'
8 changes: 4 additions & 4 deletions biosimulators_pysces/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions tests/test_core_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4c20373

Please sign in to comment.