-
Notifications
You must be signed in to change notification settings - Fork 0
/
parameters.py
45 lines (35 loc) · 1.18 KB
/
parameters.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import os
class Parameters(object):
def __init__(self, params=None):
if params != None:
self.params = params
else:
self.params = {}
self.params['folder_names'] = []
def get(self):
"""Returns the stored parameters"""
return self.params
def set(self, p):
"""Update parameters
Keyword arguments:
p -- dictionary storing parameter keys and values to be updated.
"""
if type(p) != type({'a':0}):
print 'WARNING Parameters.set got wrong argument type! No parameters were set'
return
for key in p.keys():
self.params[key] = p[key]
def initialize(self, list_of_params_to_init):
"""
Each parameter in the list_of_params_to_init should have a range(min, max):
for p in list_of_params_to_init:
"""
pass
def create_folders(self):
"""
Must be called from 'outside' this class before the simulation
"""
for f in self.params['folder_names']:
if not os.path.exists(f):
print 'Creating folder:\t%s' % f
os.system("mkdir %s" % (f))