diff --git a/boxmox/experiment.py b/boxmox/experiment.py index 0763b4dff3e9e32560f8e0b14fd94d0dff5fb0aa..f90c5d562336382e4455a36f6236887264b96471 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"))