From ed97e7510f1188c2080e0ed72d31107a238679e4 Mon Sep 17 00:00:00 2001 From: "Christoph.Knote" <christoph.knote@physik.uni-muenchen.de> Date: Thu, 14 Dec 2017 16:56:51 +0100 Subject: [PATCH] A number of updates! --- boxmox/experiment.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/boxmox/experiment.py b/boxmox/experiment.py index 8213d95..17fe76c 100644 --- a/boxmox/experiment.py +++ b/boxmox/experiment.py @@ -31,10 +31,14 @@ class ExampleData: else: raise Exception("Input file {:s} does not exist.".format(name)) def __init__(self, path): - self.path = path + 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) ) } + self.mech = 'unknown' + try: + with open( os.path.join( self.path, 'mech_used' ) ) as f: + self.mech = f.readline() + except: + pass compiledMechsPath=os.path.join(os.environ['KPP_HOME'], "boxmox", "compiled_mechs") @@ -44,6 +48,9 @@ try: except: print("No compile_mechs directory found") +_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: _examples[x] for x in _examples if _examples[x].mech in compiledMechs } + class Namelist: ''' A BOXMOX (Fortran 90) namelist. Getting and setting of values -- GitLab