From 4053ed56de4098ac38b032b7f487f475d826d8a2 Mon Sep 17 00:00:00 2001 From: "Christoph.Knote" <christoph.knote@physik.uni-muenchen.de> Date: Thu, 14 Dec 2017 11:47:01 +0100 Subject: [PATCH] Namelist sheet --- boxmox/experiment.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/boxmox/experiment.py b/boxmox/experiment.py index 0763b4d..f90c5d5 100644 --- a/boxmox/experiment.py +++ b/boxmox/experiment.py @@ -50,34 +50,34 @@ class Namelist: ''' def __getitem__(self, item): - if item.lower() in self.__namelist['boxmox'].keys(): - return self.__namelist['boxmox'][item.lower()] + if item.lower() in self._namelist['boxmox'].keys(): + return self._namelist['boxmox'][item.lower()] else: raise Exception('{:s} does not exist in Namelist.'.format(item)) def __setitem__(self, item, value): - if item.lower() in self.__namelist['boxmox'].keys(): + if item.lower() in self._namelist['boxmox'].keys(): try: - self.__namelist['boxmox'][item] = value + self._namelist['boxmox'][item] = value except: raise Exception('Failed to set {:s} to {:s}'.format(item, str(value))) else: raise Exception('{:s} does not exist in Namelist'.format(item)) def __str__(self): - return ', '.join( [ ('{:s}: {:s}'.format(item, str(self.__namelist['boxmox'][item]))) for item in self.__namelist['boxmox'].keys() ] ) + return ', '.join( [ ('{:s}: {:s}'.format(item, str(self._namelist['boxmox'][item]))) for item in self._namelist['boxmox'].keys() ] ) def keys(self): - return self.__namelist['boxmox'].keys() + return self._namelist['boxmox'].keys() def write(self, path): ''' Write namelist to file. ''' - self.__namelist.write(path, 'w') + self._namelist.write(path, 'w') def read(self, path): ''' Read namelist from file. ''' - self.__namelist = f90nml.read(path) + self._namelist = f90nml.read(path) def __init__(self, path = None): - self.__namelist = None + self._namelist = None firstExample = examples[examples.keys()[0]] self.read(os.path.join(firstExample.path, "BOXMOX.nml")) -- GitLab