diff --git a/boxmox/__init__.py b/boxmox/__init__.py index ff5cb60380642978b4a502b5084b3ab471be098d..10214cc65b6ea0d98abaec1d54632e398c1211ce 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 7af26361f82f45c1adb9fe1395a733a870c9f57a..63bd708d324164478b2bc36fab536a204047270e 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) +