From 3670875019e4e3fd681e480305d5a185c58c6a7a Mon Sep 17 00:00:00 2001 From: "Christoph.Knote" <christoph.knote@physik.uni-muenchen.de> Date: Wed, 13 Dec 2017 11:29:44 +0100 Subject: [PATCH] Updates to make restbox working again. --- boxmox/__init__.py | 2 +- boxmox/experiment.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/boxmox/__init__.py b/boxmox/__init__.py index ff5cb60..10214cc 100644 --- a/boxmox/__init__.py +++ b/boxmox/__init__.py @@ -8,7 +8,7 @@ if work_path is None: import warnings warnings.warn("BOXMOX unusable - experiment execution disabled.") else: - from experiment import Experiment, ExperimentFromExample, ExperimentFromExistingRun, Namelist, examples + from experiment import Experiment, ExperimentFromExample, ExperimentFromExistingRun, Namelist, examples, compiledMechs try: import matplotlib diff --git a/boxmox/experiment.py b/boxmox/experiment.py index 7af2636..63bd708 100644 --- a/boxmox/experiment.py +++ b/boxmox/experiment.py @@ -33,7 +33,11 @@ class ExampleData: self.path = path self.files = { x.replace(".csv", ""): os.path.join(self.path, x) for x in os.listdir(self.path) if '.csv' in x } -examples = { x: ExampleData(os.path.join(examplesPath, x)) for x in os.listdir(examplesPath) if os.path.isdir( os.path.join(examplesPath, x))} +examples = { x: ExampleData(os.path.join(examplesPath, x)) for x in os.listdir(examplesPath) if os.path.isdir( os.path.join(examplesPath, x) ) } + +compiledMechsPath=os.path.join(os.environ['KPP_HOME'], "boxmox", "compiled_mechs") + +compiledMechs = [ x for x in os.listdir(compiledMechsPath) if (os.path.isdir( os.path.join(compiledMechsPath, x) )) and ("_adjoint" not in x) ] class Namelist: ''' @@ -300,6 +304,8 @@ class ExperimentFromExample(Experiment): self.namelist = Namelist(os.path.join(self.path, 'BOXMOX.nml')) self.mechanism = self._get_mechanism() + self.version = self._determineVersion(self.path) + def __new(self): try: s.check_output(["new_BOXMOX_experiment_from_example", "-f", self.example, self.path], stderr=s.STDOUT) @@ -336,8 +342,11 @@ class ExperimentFromExistingRun(Experiment): self.namelist = Namelist(os.path.join(self.path, 'BOXMOX.nml')) self.mechanism = self._get_mechanism() + self.version = self._determineVersion(self.path) + self._populateInput() self._populateOutput(filename=filename) + -- GitLab