mg-pso-gui 0.1.13__py3-none-any.whl → 0.2.75__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. {mg_pso_gui-0.1.13.dist-info → mg_pso_gui-0.2.75.dist-info}/METADATA +10 -11
  2. mg_pso_gui-0.2.75.dist-info/RECORD +76 -0
  3. {mg_pso_gui-0.1.13.dist-info → mg_pso_gui-0.2.75.dist-info}/WHEEL +1 -1
  4. mgpsogui/gui/General/ParameterView.py +110 -0
  5. mgpsogui/gui/General/__init__.py +0 -0
  6. mgpsogui/gui/HomePage.py +565 -513
  7. mgpsogui/gui/OptionManager.py +333 -145
  8. mgpsogui/gui/OptionManager_backup.py +443 -0
  9. mgpsogui/gui/PlatformTab/PlatformTab.py +15 -6
  10. mgpsogui/gui/RunTab/OptimalParameterView.py +47 -0
  11. mgpsogui/gui/RunTab/RunTab.py +89 -35
  12. mgpsogui/gui/SetupTab/BoundsEditorWindow.py +1 -1
  13. mgpsogui/gui/SetupTab/BoundsList.py +97 -34
  14. mgpsogui/gui/SetupTab/CustomFunctionEditorWindow.py +74 -0
  15. mgpsogui/gui/SetupTab/CustomFunctionMetrics.py +156 -0
  16. mgpsogui/gui/SetupTab/FunctionsList.py +60 -6
  17. mgpsogui/gui/SetupTab/{StaticParameterView.py → ListEditor.py} +27 -16
  18. mgpsogui/gui/SetupTab/ListParametersView.py +7 -6
  19. mgpsogui/gui/SetupTab/{CalibrationParametersView.py → OverrideParameterMetrics.py} +35 -9
  20. mgpsogui/gui/SetupTab/OverrideParameterWindow.py +40 -0
  21. mgpsogui/gui/SetupTab/SetupTab.py +31 -11
  22. mgpsogui/gui/SetupTab/StepView.py +93 -22
  23. mgpsogui/gui/VisualizeTab/MatrixEditor.py +68 -0
  24. mgpsogui/gui/VisualizeTab/SideBar.py +399 -0
  25. mgpsogui/gui/VisualizeTab/VisualizeTab.py +76 -11
  26. mgpsogui/gui/defaults/__init__.py +0 -0
  27. mgpsogui/gui/defaults/optimization.json +176 -0
  28. mgpsogui/gui/defaults/sampling.json +111 -0
  29. mgpsogui/gui/defaults/sensitivity.json +20 -0
  30. mgpsogui/gui/images/plus.png +0 -0
  31. mgpsogui/gui/images/test.png +0 -0
  32. mgpsogui/util/GraphGenerator.py +747 -42
  33. mgpsogui/util/PSORunner.py +608 -116
  34. mgpsogui/util/debug.py +559 -0
  35. mgpsogui/util/helpers.py +95 -0
  36. mgpsogui/util/recosu/__init__.py +2 -1
  37. mgpsogui/util/recosu/pso/csip_access.py +2 -35
  38. mgpsogui/util/recosu/pso/pso.py +55 -59
  39. mgpsogui/util/recosu/sampling/__init__.py +16 -0
  40. mgpsogui/util/recosu/sampling/halton/__init__.py +0 -0
  41. mgpsogui/util/recosu/sampling/halton/halton.py +45 -0
  42. mgpsogui/util/recosu/sampling/halton/prime.py +82 -0
  43. mgpsogui/util/recosu/sampling/random/__init__.py +0 -0
  44. mgpsogui/util/recosu/sampling/random/random_sampler.py +34 -0
  45. mgpsogui/util/recosu/sampling/sample_trace_writer.py +47 -0
  46. mgpsogui/util/recosu/sampling/sampler_task.py +75 -0
  47. mgpsogui/util/recosu/sampling/sampling.py +99 -0
  48. mgpsogui/util/sampler_test_driver.py +129 -0
  49. mg_pso_gui-0.1.13.dist-info/RECORD +0 -50
  50. mgpsogui/gui/images/IGOW 4 Logo.png +0 -0
  51. {mg_pso_gui-0.1.13.dist-info → mg_pso_gui-0.2.75.dist-info}/entry_points.txt +0 -0
  52. {mg_pso_gui-0.1.13.dist-info → mg_pso_gui-0.2.75.dist-info}/top_level.txt +0 -0
@@ -1,33 +1,134 @@
1
1
  from tkinter import StringVar as sv
2
- from tkinter import IntVar as iv
3
- from tkinter import BooleanVar as bv
4
- from tkinter import DoubleVar as dv
5
2
  import json
3
+ import os
6
4
 
7
5
  class OptionManager():
8
6
 
9
7
  def __init__(self):
10
-
11
- self.project_data = {"name": "", "path": ""}
12
- self.arguments = {"param": [],
13
- "url": sv(),
14
- "files": {},
15
- "calibration_parameters": []}
16
- self.steps = []
17
- self.service_parameters = {}
8
+
9
+ self._service_modes = ["Sampling: Halton", "Sampling: Random", "Sensitivity Analysis", "Optimization"]
10
+
11
+ self._default_sampling = json.load(open(os.path.join("./defaults", "sampling.json")))
12
+ self._default_sensitivity = json.load(open(os.path.join("./defaults", "sensitivity.json")))
13
+ self._default_optimization = json.load(open(os.path.join("./defaults", "optimization.json")))
14
+
15
+ self._mode_sv = sv()
16
+ self.init_lists()
17
+
18
+ def init_lists(self):
19
+ self._project_data = {"name": "", "path": ""}
20
+ self._data = {}
21
+
22
+ self._mode_sv.set("Sampling: Halton")
23
+
24
+ for service in self._service_modes:
25
+ self._data[service] = {
26
+ "url": sv(),
27
+ "files": {},
28
+ "steps": [],
29
+ "model_parameters": [],
30
+ "hyperparameters": [],
31
+ "service_parameters": [],
32
+ "service_request_data": [],
33
+ "figure_parameters": [],
34
+ "sensitivity_parameters": [],
35
+ "sensitivity_positiveBestMetrics": [],
36
+ "sensitivity_negativeBestMetrics": [],
37
+
38
+ "sensitivity_analysis_path": sv(),
39
+ "sampling_output_mode": sv(),
40
+ "selected_graph": sv(),
41
+ "graph_theme": sv(),
42
+ "selected_csv": sv(),
43
+ "selected_csv2": sv(),
44
+ "selected_x": sv(),
45
+ "selected_y1": sv(),
46
+ "selected_y2": sv(),
47
+ "figure_style": sv(),
48
+ "matrix_values": []
49
+ }
18
50
 
19
- def clear(self):
20
- self.arguments['param'].clear()
21
- self.arguments['url'].set("")
22
- self.arguments['files'] = {}
23
- self.arguments['calibration_parameters'].clear()
24
- self.steps = []
25
- self.service_parameters = {}
26
-
27
- def add_arguments(self, arguments):
51
+ self._data[service]["sensitivity_analysis_path"].set("No file selected...")
52
+ self._data[service]["sampling_output_mode"].set("Replace")
53
+ self._data[service]["selected_graph"].set("None")
54
+ self._data[service]["graph_theme"].set("Dark")
55
+ self._data[service]["selected_csv"].set("No files found...")
56
+ self._data[service]["selected_csv2"].set("No files found...")
57
+ self._data[service]["selected_x"].set("time")
58
+ self._data[service]["selected_y1"].set("NONE")
59
+ self._data[service]["selected_y2"].set("NONE")
60
+ self._data[service]["figure_style"].set("Scatter")
61
+ self._data[service]["matrix_values"].append(sv())
62
+ self._data[service]["matrix_values"][0].set("NONE")
63
+
64
+
65
+ if service == "Sampling: Halton" or service == "Sampling: Random":
66
+ self._data[service]["model_parameters"] = self.deserialize_data(self._default_sampling["model_parameters"])
67
+ self._data[service]["hyperparameters"] = self.deserialize_data(self._default_sampling["hyperparameters"])
68
+ self._data[service]["service_parameters"] = self.deserialize_data(self._default_sampling["service_parameters"])
69
+ elif service == "Sensitivity Analysis":
70
+ self._data[service]["model_parameters"] = self.deserialize_data(self._default_sensitivity["model_parameters"])
71
+ self._data[service]["hyperparameters"] = self.deserialize_data(self._default_sensitivity["hyperparameters"])
72
+ self._data[service]["service_parameters"] = self.deserialize_data(self._default_sensitivity["service_parameters"])
73
+ elif service == "Optimization":
74
+ self._data[service]["model_parameters"] = self.deserialize_data(self._default_optimization["model_parameters"])
75
+ self._data[service]["hyperparameters"] = self.deserialize_data(self._default_optimization["hyperparameters"])
76
+ self._data[service]["service_parameters"] = self.deserialize_data(self._default_optimization["service_parameters"])
77
+
78
+
79
+ def serialize_data(self, data):
80
+ if isinstance(data, dict):
81
+ return {key: self.serialize_data(value) for key, value in data.items()}
82
+ elif isinstance(data, list):
83
+ return [self.serialize_data(item) for item in data]
84
+ elif isinstance(data, sv):
85
+ return data.get()
86
+ else:
87
+ return data
88
+
89
+ def deserialize_data(self, data):
90
+ if isinstance(data, dict):
91
+ return {key: self.deserialize_data(value) for key, value in data.items()}
92
+ elif isinstance(data, list):
93
+ return [self.deserialize_data(item) for item in data]
94
+ elif isinstance(data, (str, int, float)):
95
+ return sv(value=str(data))
96
+ else:
97
+ return data
28
98
 
99
+ def save_project(self, filename):
100
+ with open(filename, 'w') as file:
101
+ results = {"project_data": self._project_data,
102
+ "mode": self._mode_sv.get(),
103
+ "data": self.serialize_data(self._data)}
104
+ json.dump(results, file)
105
+
106
+ def get_all_data(self):
107
+ return self.serialize_data(self._data)
108
+
109
+ def load_project(self, filename):
110
+ self.init_lists()
111
+
112
+ with open(filename, 'r') as file:
113
+ results = json.load(file)
114
+ new_project_data = results["project_data"]
115
+ for key, value in new_project_data.items():
116
+ self._project_data[key] = value
117
+ self._mode_sv.set(results["mode"])
118
+ new_data = self.deserialize_data(results["data"])
119
+
120
+ for service in self._service_modes:
121
+ for key, value in new_data[service].items():
122
+ self._data[service][key] = value
123
+
124
+
125
+ def add_arguments(self, arguments):
126
+
127
+ if ("mode" in arguments):
128
+ self._data["mode"].set(arguments["mode"])
129
+
29
130
  if ("url" in arguments):
30
- self.arguments["url"].set(arguments["url"])
131
+ self._data["url"][self._data["mode"].get()].set(arguments["url"])
31
132
 
32
133
  if ("files" in arguments):
33
134
  for file in arguments["files"]:
@@ -36,98 +137,161 @@ class OptionManager():
36
137
  obj = {"name": sv(), "value": sv()}
37
138
  obj["name"].set(name)
38
139
  obj["value"].set(value)
39
- self.arguments["files"][name] = obj
140
+ self._data["files"][name] = obj
40
141
 
41
- for param in arguments["param"]:
142
+ for param in arguments["model_parameters"]:
42
143
  name = param["name"]
43
144
  value = param["value"]
44
145
  obj = {"name": sv(), "value": sv()}
45
146
  obj["name"].set(name)
46
147
  obj["value"].set(value)
47
- self.arguments["param"].append(obj)
148
+ self._data["model_parameters"].append(obj)
48
149
 
49
- for param in arguments["calibration_parameters"]:
150
+ for param in arguments["hyperparameters"]:
151
+ name = param["name"]
152
+ value = param["value"]
153
+ obj = {"name": sv(), "value": sv()}
154
+ obj["name"].set(name)
155
+ obj["value"].set(value)
156
+ self._data["hyperparameters"].append(obj)
157
+
158
+ for param in arguments["service_parameters"]:
50
159
  name = param["name"]
51
160
  value = param["value"]
52
161
  obj = {"name": sv(), "value": sv()}
53
162
  obj["name"].set(name)
54
163
  obj["value"].set(value)
55
- self.arguments["calibration_parameters"].append(obj)
164
+ self._data["service_parameters"].append(obj)
56
165
 
57
166
  def add_steps(self, steps):
58
167
  for step in steps:
59
- obj = {"param": [], "objfunc": [], "name": sv(), "message": sv(), "open": False}
60
- obj["name"].set("Group " + str(len(self.steps) + 1))
61
- obj["message"].set("Wow")
62
-
63
- for param in step["param"]:
64
- param_obj = {
168
+ obj = {"parameter_objects": [],
169
+ "override_parameter": [],
170
+ "objective_functions": [],
65
171
  "name": sv(),
66
- "bounds": (sv(), sv()),
67
- "default_value": sv(),
68
- "type": sv(),
69
- "calibration_strategy": sv()
70
- }
71
- param_obj["name"].set(param["name"])
72
- if "bounds" in param:
73
- param_obj["bounds"][0].set(param["bounds"][0])
74
- param_obj["bounds"][1].set(param["bounds"][1])
75
- else:
76
- param_obj["bounds"][0].set(0)
77
- param_obj["bounds"][1].set(1)
78
- if "type" in param:
79
- param_obj["type"].set(param["type"])
80
- else:
81
- param_obj["type"].set("float")
82
- if "default_value" in param:
83
- param_obj["default_value"].set(param["default_value"])
84
- else:
85
- param_obj["default_value"].set(1)
86
- if "calibration_strategy" in param:
87
- param_obj["calibration_strategy"].set(param["calibration_strategy"])
88
- else:
89
- param_obj["calibration_strategy"].set("none")
90
- obj["param"].append(param_obj)
172
+ "open": True}
173
+ obj["name"].set("Group " + str(len(self._data[self._mode_sv.get()]["steps"]) + 1))
174
+
175
+ if "parameter_objects" in step:
176
+ for param in step["parameter_objects"]:
177
+ param_obj = {
178
+ "name": sv(),
179
+ "min_bound": sv(),
180
+ "max_bound": sv(),
181
+ "default_value": sv(),
182
+ "optimal_value": sv(),
183
+ "type": sv(),
184
+ "calibration_strategy": sv()
185
+ }
186
+ param_obj["name"].set(param["name"])
187
+
188
+ if "min_bound" in param:
189
+ param_obj["min_bound"].set(param["min_bound"])
190
+ else:
191
+ param_obj["min_bound"].set(0)
192
+
193
+ if "max_bound" in param:
194
+ param_obj["max_bound"].set(param["max_bound"])
195
+ else:
196
+ param_obj["max_bound"].set(0)
197
+
198
+ if "type" in param:
199
+ param_obj["type"].set(param["type"])
200
+ else:
201
+ param_obj["type"].set("float")
202
+
203
+ if "default_value" in param:
204
+ param_obj["default_value"].set(param["default_value"])
205
+ else:
206
+ param_obj["default_value"].set(1)
207
+
208
+ if "optimal_value" in param:
209
+ param_obj["optimal_value"].set(param["optimal_value"])
210
+ else:
211
+ param_obj["optimal_value"].set(0)
212
+
213
+ if "calibration_strategy" in param:
214
+ param_obj["calibration_strategy"].set(param["calibration_strategy"])
215
+ else:
216
+ param_obj["calibration_strategy"].set("none")
217
+
218
+ obj["parameter_objects"].append(param_obj)
91
219
 
92
- for objfunc in step["objfunc"]:
93
- objfunc_obj = {"name": sv(), "of": sv(), "weight": sv(), "data": (sv(), sv())}
94
- objfunc_obj["name"].set(objfunc["name"])
95
- objfunc_obj["of"].set(objfunc["of"])
96
-
97
- if ("weight" in objfunc):
98
- objfunc_obj["weight"].set(objfunc["weight"])
99
- else:
100
- objfunc_obj["weight"].set(1)
220
+ if "override_parameter" in step:
221
+ for override in step["override_parameter"]:
222
+ override_obj = {"name": sv(), "value": sv()}
223
+ override_obj['name'].set(override['name'])
224
+ override_obj['value'].set(override['value'])
225
+ obj['override_parameter'].append(override_obj)
226
+
227
+ if "objective_functions" in step:
228
+ for objective_function in step["objective_functions"]:
229
+ objective_function_object = {"name": sv(),
230
+ "objective_function": sv(),
231
+ "weight": sv(),
232
+ "custom_function": sv(),
233
+ "custom_function_goal": sv(),
234
+ "custom_function_value": sv(),
235
+ "data_observed": sv(),
236
+ "data_simulated": sv()}
237
+ objective_function_object["name"].set(objective_function["name"])
238
+ objective_function_object["objective_function"].set(objective_function["objective_function"])
239
+ objective_function_object["custom_function_goal"].set("Positive Best")
101
240
 
102
- objfunc_obj["data"][0].set(objfunc["data"][0])
103
- objfunc_obj["data"][1].set(objfunc["data"][1])
104
- obj["objfunc"].append(objfunc_obj)
241
+ if ("weight" in objective_function):
242
+ objective_function_object["weight"].set(objective_function["weight"])
243
+ else:
244
+ objective_function_object["weight"].set(1)
245
+
246
+ if ("custom_function" in objective_function):
247
+ objective_function_object["custom_function"].set(objective_function["custom_function"])
248
+ if ("custom_function_goal" in objective_function):
249
+ objective_function_object["custom_function_goal"].set(objective_function["custom_function_goal"])
250
+ if ("custom_function_value" in objective_function):
251
+ objective_function_object["custom_function_value"].set(objective_function["custom_function_value"])
252
+
253
+ objective_function_object["data_observed"].set(objective_function["data_observed"])
254
+ objective_function_object["data_simulated"].set(objective_function["data_simulated"])
255
+ obj["objective_functions"].append(objective_function_object)
105
256
 
106
- self.steps.append(obj)
257
+ self._data[self._mode_sv.get()]["steps"].append(obj)
107
258
 
108
259
  def add_function(self, step_index):
109
- obj = {"name": sv(), "of": sv(), "weight": sv(), "data": (sv(), sv())}
260
+ obj = {"name": sv(),
261
+ "objective_function": sv(),
262
+ "weight": sv(),
263
+ "custom_function": sv(),
264
+ "data_observed": sv(),
265
+ "data_simulated": sv()}
110
266
  obj["name"].set("ns")
111
- obj["of"].set("ns")
267
+ obj["objective_function"].set("ns")
112
268
  obj["weight"].set(1)
113
- obj["data"][0].set("")
114
- obj["data"][1].set("")
115
- self.steps[step_index]["objfunc"].append(obj)
269
+ obj["data_observed"].set("")
270
+ obj["data_simulated"].set("")
271
+ obj["custom_function"].set("")
272
+
273
+ self._data[self._mode_sv.get()]["steps"][step_index]["objective_functions"].append(obj)
116
274
 
117
275
  def remove_function(self, step_index, index):
118
- self.steps[step_index]["objfunc"].pop(index)
276
+ self._data[self._mode_sv.get()]["steps"][step_index]["objective_functions"].pop(index)
119
277
 
120
278
  def dupe_function(self, step_index, index):
121
- my_func = self.steps[step_index]["objfunc"][index]
279
+ my_func = self._data[self._mode_sv.get()]["steps"][step_index]["objective_functions"][index]
122
280
 
123
- new_object = {"name": sv(), "of": sv(), "weight": sv(), "data": (sv(), sv())}
281
+ new_object = {"name": sv(),
282
+ "objective_function": sv(),
283
+ "weight": sv(),
284
+ "custom_function": sv(),
285
+ "data_observed": sv(),
286
+ "data_simulated": sv()}
124
287
  new_object["name"].set(my_func["name"].get())
125
- new_object["of"].set(my_func["of"].get())
288
+ new_object["objective_function"].set(my_func["objective_function"].get())
126
289
  new_object["weight"].set(my_func["weight"].get())
127
- new_object["data"][0].set(my_func["data"][0].get())
128
- new_object["data"][1].set(my_func["data"][1].get())
290
+ new_object["data_observed"].set(my_func["data_observed"].get())
291
+ new_object["data_simulated"].set(my_func["data_simulated"].get())
292
+ new_object["custom_function"].set(my_func["custom_function"].get())
129
293
 
130
- self.steps[step_index]["objfunc"].append(new_object)
294
+ self._data[self._mode_sv.get()]["steps"][step_index]["objective_functions"].append(new_object)
131
295
 
132
296
  def add_bound(self, step_index,
133
297
  name="name",
@@ -135,99 +299,125 @@ class OptionManager():
135
299
  max=1,
136
300
  type="float",
137
301
  default_value=1,
302
+ optimal_value=0,
138
303
  calibration_strategy="none"):
139
304
  obj = {
140
305
  "name": sv(),
141
- "bounds": (sv(), sv()),
306
+ "min_bound": sv(),
307
+ "max_bound": sv(),
142
308
  "default_value": sv(),
309
+ "optimal_value": sv(),
143
310
  "type": sv(),
144
311
  "calibration_strategy": sv()
145
312
  }
146
313
  obj["name"].set(name)
147
314
  obj["type"].set(type)
148
315
  obj["default_value"].set(default_value)
316
+ obj["optimal_value"].set(optimal_value)
149
317
  obj["calibration_strategy"].set(calibration_strategy)
150
- obj["bounds"][0].set(min)
151
- obj["bounds"][1].set(max)
152
- self.steps[step_index]["param"].append(obj)
318
+ obj["min_bound"].set(min)
319
+ obj["max_bound"].set(max)
320
+ self._data[self._mode_sv.get()]["steps"][step_index]["parameter_objects"].append(obj)
153
321
 
154
322
  def remove_bound(self, step_index, index):
155
- self.steps[step_index]["param"].pop(index)
323
+ self._data[self._mode_sv.get()]["steps"][step_index]["parameter_objects"].pop(index)
156
324
 
157
- def add_argument(self, key, value):
325
+ def add_override(self, step_index, name, value):
158
326
  obj = {"name": sv(), "value": sv()}
159
- obj["name"].set(key)
327
+ obj["name"].set(name)
160
328
  obj["value"].set(value)
161
- self.arguments["param"].append(obj)
162
-
163
- def add_calibration_param(self, key, value):
164
- obj = {"name": sv(), "value": sv()}
329
+ self._data[self._mode_sv.get()]["steps"][step_index]["override_parameter"].append(obj)
330
+
331
+ def remove_override(self, step_index, index):
332
+ self._data[self._mode_sv.get()]["steps"][step_index]["override_parameter"].pop(index)
333
+
334
+ def get_override(self, step_index):
335
+ return self._data[self._mode_sv.get()]["steps"][step_index]["override_parameter"]
336
+
337
+ def add_key_value(self, list_name, key, value, type="string", destination="args"):
338
+ obj = {"name": sv(), "value": sv(), "type": sv(), "destination": sv()}
165
339
  obj["name"].set(key)
166
340
  obj["value"].set(value)
167
- self.arguments["calibration_parameters"].append(obj)
168
-
169
- def move_argument_up(self, index):
170
- if index > 0:
171
- self.arguments["param"][index], self.arguments["param"][index - 1] = self.arguments["param"][index - 1], self.arguments["param"][index]
172
-
173
- def move_argument_down(self, index):
174
- if index < len(self.arguments["param"]) - 1:
175
- self.arguments["param"][index], self.arguments["param"][index + 1] = self.arguments["param"][index + 1], self.arguments["param"][index]
341
+ obj["type"].set(type)
342
+ obj["destination"].set(destination)
343
+ self._data[self._mode_sv.get()][list_name].append(obj)
344
+
345
+ def remove_key_value(self, list_name, index):
346
+ self._data[self._mode_sv.get()][list_name].pop(index)
176
347
 
177
348
  def move_step_up(self, index):
178
349
  if index > 0:
179
- self.steps[index], self.steps[index - 1] = self.steps[index - 1], self.steps[index]
350
+ self._data[self._mode_sv.get()]["steps"][index], self._data[self._mode_sv.get()]["steps"][index - 1] = self._data[self._mode_sv.get()]["steps"][index - 1], self._data[self._mode_sv.get()]["steps"][index]
180
351
 
181
352
  def move_step_down(self, index):
182
- if index < len(self.steps) - 1:
183
- self.steps[index], self.steps[index + 1] = self.steps[index + 1], self.steps[index]
353
+ if index < len(self._data[self._mode_sv.get()]["steps"]) - 1:
354
+ self._data[self._mode_sv.get()]["steps"][index], self._data[self._mode_sv.get()]["steps"][index + 1] = self._data[self._mode_sv.get()]["steps"][index + 1], self._data[self._mode_sv.get()]["steps"][index]
184
355
 
185
356
  def toggle_step_open(self, index):
186
- self.steps[index]["open"] = not self.steps[index]["open"]
187
-
188
- def remove_argument(self, index):
189
- self.arguments["param"].pop(index)
190
-
191
- def remove_calibration_parameter(self, index):
192
- self.arguments["calibration_parameters"].pop(index)
193
-
357
+ self._data[self._mode_sv.get()]["steps"][index]["open"] = not self._data[self._mode_sv.get()]["steps"][index]["open"]
358
+
194
359
  def remove_step(self, index):
195
- self.steps.pop(index)
360
+ self._data[self._mode_sv.get()][self._mode_sv.get()]["steps"].pop(index)
196
361
 
197
362
  def get_project_data(self):
198
- return self.project_data
363
+ return self._project_data
199
364
 
200
365
  def set_path(self, filename):
201
366
  file_name = filename.split("/")[-1].replace(".json", "")
202
367
  path = filename.replace(file_name + ".json", "")
203
- self.project_data["path"] = path
204
- self.project_data["name"] = file_name
368
+ self._project_data["path"] = path
369
+ self._project_data["name"] = file_name
370
+
371
+ def copy_list(self, source_mode):
372
+ self._data[self._mode_sv.get()] = self._data[source_mode]
205
373
 
206
- def get_arguments(self):
207
- return self.arguments
374
+ def get_data(self):
375
+ return self._data[self._mode_sv.get()]
208
376
 
209
377
  def get_steps(self):
210
- return self.steps
211
-
212
-
378
+ return self._data[self._mode_sv.get()]["steps"]
379
+
380
+ def get_mode(self):
381
+ return self._mode_sv.get()
382
+
383
+ def get_mode_sv(self):
384
+ return self._mode_sv
385
+
386
+ def get_service_modes(self):
387
+ return self._service_modes
388
+
389
+ def get_list(self, list_name):
390
+ return self._data[self._mode_sv.get()][list_name]
391
+
392
+ def get(self, key):
393
+ return self._data[self._mode_sv.get()][key]
394
+
395
+ def set_data(self, key, value):
396
+ self._data[self._mode_sv.get()][key] = value
397
+
398
+ def set_var(self, key, value):
399
+ self._data[self._mode_sv.get()][key].set(value)
400
+
213
401
  def get_all_as_json(self):
214
- obj = {"arguments": self.arguments, "steps": self.steps}
402
+ obj = {"arguments": self._data, "steps": self._data[self._mode_sv.get()]["steps"]}
215
403
  return obj
216
404
 
217
- def set_service_parameters(self, service_parameters):
218
- self.service_parameters = service_parameters
219
-
220
- def get_service_parameters(self):
221
- return self.service_parameters
405
+ def get_project_folder(self):
406
+ return os.path.join(self._project_data['path'], self._project_data['name'])
222
407
 
408
+
223
409
  def get_metrics(self):
410
+
411
+ self._data["url"].set(self._data["urls"][self._data["mode"].get()].get())
412
+
224
413
  result = {}
225
414
  result['arguments'] = {}
226
- result['calibration_parameters'] = []
415
+ result['hyperparameters'] = []
416
+ result['service_parameters'] = []
227
417
  result['service_parameters'] = {}
228
- result['project_data'] = self.project_data
229
- for key, value in self.arguments.items():
230
- if key == 'url':
418
+ result['project_data'] = self._project_data
419
+ for key, value in self._data.items():
420
+ if key == 'url' or key == 'mode':
231
421
  result['arguments'][key] = value.get()
232
422
  elif key == 'files':
233
423
  result['arguments'][key] = {}
@@ -237,12 +427,16 @@ class OptionManager():
237
427
  result['arguments'][key] = []
238
428
  for obj in value:
239
429
  result['arguments'][key].append({'name': obj['name'].get(), 'value': obj['value'].get()})
240
- elif key == "calibration_parameters":
241
- #result['calibration_parameters'][key] = []
430
+ elif key == "hyperparameters":
431
+ #result['hyperparameters'][key] = []
432
+ for obj in value:
433
+ result['hyperparameters'].append({'name': obj['name'].get(), 'value': obj['value'].get()})
434
+ elif key == "service_parameters":
435
+ #result['service_parameters'][key] = []
242
436
  for obj in value:
243
- result['calibration_parameters'].append({'name': obj['name'].get(), 'value': obj['value'].get()})
437
+ result['service_parameters'].append({'name': obj['name'].get(), 'value': obj['value'].get()})
244
438
  result['steps'] = []
245
- for step in self.steps:
439
+ for step in self._data[self._mode_sv.get()]["steps"]:
246
440
  step_result = {}
247
441
  #step_result['name'] = step['name'].get()
248
442
  #step_result['open'] = step['open']
@@ -257,6 +451,7 @@ class OptionManager():
257
451
  'bounds': (float(param['bounds'][0].get()),
258
452
  float(param['bounds'][1].get())),
259
453
  'default_value': float(param['default_value'].get()),
454
+ 'optimal_value': float(param['optimal_value'].get()),
260
455
  'type': 'float',
261
456
  'calibration_strategy': param['calibration_strategy'].get()
262
457
  }
@@ -268,20 +463,13 @@ class OptionManager():
268
463
  'bounds': (float(param['bounds'][0].get()),
269
464
  float(param['bounds'][1].get())),
270
465
  'default_value': param['default_value'].get(),
466
+ 'optimal_value': param['optimal_value'].get(),
271
467
  'type': 'list',
272
468
  'calibration_strategy': param['calibration_strategy'].get()
273
469
  }
274
470
  )
275
- #except ValueError:
276
- # step_result['param'].append(
277
- # {
278
- # 'name': param['name'].get(),
279
- # 'bounds': (param['bounds'][0].get(),
280
- # param['bounds'][1].get())
281
- # }
282
- # )
283
471
  step_result['objfunc'] = []
284
472
  for objfunc in step['objfunc']:
285
473
  step_result['objfunc'].append({'name': objfunc['name'].get(), 'of': objfunc['of'].get(), 'weight': float(objfunc['weight'].get()), 'data': (objfunc['data'][0].get(), objfunc['data'][1].get())})
286
474
  result['steps'].append(step_result)
287
- return result
475
+ return result