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.
- {mg_pso_gui-0.1.13.dist-info → mg_pso_gui-0.2.75.dist-info}/METADATA +10 -11
- mg_pso_gui-0.2.75.dist-info/RECORD +76 -0
- {mg_pso_gui-0.1.13.dist-info → mg_pso_gui-0.2.75.dist-info}/WHEEL +1 -1
- mgpsogui/gui/General/ParameterView.py +110 -0
- mgpsogui/gui/General/__init__.py +0 -0
- mgpsogui/gui/HomePage.py +565 -513
- mgpsogui/gui/OptionManager.py +333 -145
- mgpsogui/gui/OptionManager_backup.py +443 -0
- mgpsogui/gui/PlatformTab/PlatformTab.py +15 -6
- mgpsogui/gui/RunTab/OptimalParameterView.py +47 -0
- mgpsogui/gui/RunTab/RunTab.py +89 -35
- mgpsogui/gui/SetupTab/BoundsEditorWindow.py +1 -1
- mgpsogui/gui/SetupTab/BoundsList.py +97 -34
- mgpsogui/gui/SetupTab/CustomFunctionEditorWindow.py +74 -0
- mgpsogui/gui/SetupTab/CustomFunctionMetrics.py +156 -0
- mgpsogui/gui/SetupTab/FunctionsList.py +60 -6
- mgpsogui/gui/SetupTab/{StaticParameterView.py → ListEditor.py} +27 -16
- mgpsogui/gui/SetupTab/ListParametersView.py +7 -6
- mgpsogui/gui/SetupTab/{CalibrationParametersView.py → OverrideParameterMetrics.py} +35 -9
- mgpsogui/gui/SetupTab/OverrideParameterWindow.py +40 -0
- mgpsogui/gui/SetupTab/SetupTab.py +31 -11
- mgpsogui/gui/SetupTab/StepView.py +93 -22
- mgpsogui/gui/VisualizeTab/MatrixEditor.py +68 -0
- mgpsogui/gui/VisualizeTab/SideBar.py +399 -0
- mgpsogui/gui/VisualizeTab/VisualizeTab.py +76 -11
- mgpsogui/gui/defaults/__init__.py +0 -0
- mgpsogui/gui/defaults/optimization.json +176 -0
- mgpsogui/gui/defaults/sampling.json +111 -0
- mgpsogui/gui/defaults/sensitivity.json +20 -0
- mgpsogui/gui/images/plus.png +0 -0
- mgpsogui/gui/images/test.png +0 -0
- mgpsogui/util/GraphGenerator.py +747 -42
- mgpsogui/util/PSORunner.py +608 -116
- mgpsogui/util/debug.py +559 -0
- mgpsogui/util/helpers.py +95 -0
- mgpsogui/util/recosu/__init__.py +2 -1
- mgpsogui/util/recosu/pso/csip_access.py +2 -35
- mgpsogui/util/recosu/pso/pso.py +55 -59
- mgpsogui/util/recosu/sampling/__init__.py +16 -0
- mgpsogui/util/recosu/sampling/halton/__init__.py +0 -0
- mgpsogui/util/recosu/sampling/halton/halton.py +45 -0
- mgpsogui/util/recosu/sampling/halton/prime.py +82 -0
- mgpsogui/util/recosu/sampling/random/__init__.py +0 -0
- mgpsogui/util/recosu/sampling/random/random_sampler.py +34 -0
- mgpsogui/util/recosu/sampling/sample_trace_writer.py +47 -0
- mgpsogui/util/recosu/sampling/sampler_task.py +75 -0
- mgpsogui/util/recosu/sampling/sampling.py +99 -0
- mgpsogui/util/sampler_test_driver.py +129 -0
- mg_pso_gui-0.1.13.dist-info/RECORD +0 -50
- mgpsogui/gui/images/IGOW 4 Logo.png +0 -0
- {mg_pso_gui-0.1.13.dist-info → mg_pso_gui-0.2.75.dist-info}/entry_points.txt +0 -0
- {mg_pso_gui-0.1.13.dist-info → mg_pso_gui-0.2.75.dist-info}/top_level.txt +0 -0
mgpsogui/gui/OptionManager.py
CHANGED
@@ -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.
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
self.
|
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
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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.
|
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.
|
140
|
+
self._data["files"][name] = obj
|
40
141
|
|
41
|
-
for param in arguments["
|
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.
|
148
|
+
self._data["model_parameters"].append(obj)
|
48
149
|
|
49
|
-
for param in arguments["
|
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.
|
164
|
+
self._data["service_parameters"].append(obj)
|
56
165
|
|
57
166
|
def add_steps(self, steps):
|
58
167
|
for step in steps:
|
59
|
-
obj = {"
|
60
|
-
|
61
|
-
|
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
|
-
"
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
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
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
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
|
-
|
103
|
-
|
104
|
-
|
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(),
|
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["
|
267
|
+
obj["objective_function"].set("ns")
|
112
268
|
obj["weight"].set(1)
|
113
|
-
obj["
|
114
|
-
obj["
|
115
|
-
|
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]["
|
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]["
|
279
|
+
my_func = self._data[self._mode_sv.get()]["steps"][step_index]["objective_functions"][index]
|
122
280
|
|
123
|
-
new_object = {"name": 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["
|
288
|
+
new_object["objective_function"].set(my_func["objective_function"].get())
|
126
289
|
new_object["weight"].set(my_func["weight"].get())
|
127
|
-
new_object["
|
128
|
-
new_object["
|
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]["
|
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
|
-
"
|
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["
|
151
|
-
obj["
|
152
|
-
self.steps[step_index]["
|
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]["
|
323
|
+
self._data[self._mode_sv.get()]["steps"][step_index]["parameter_objects"].pop(index)
|
156
324
|
|
157
|
-
def
|
325
|
+
def add_override(self, step_index, name, value):
|
158
326
|
obj = {"name": sv(), "value": sv()}
|
159
|
-
obj["name"].set(
|
327
|
+
obj["name"].set(name)
|
160
328
|
obj["value"].set(value)
|
161
|
-
self.
|
162
|
-
|
163
|
-
def
|
164
|
-
|
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
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
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.
|
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.
|
204
|
-
self.
|
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
|
207
|
-
return self.
|
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.
|
402
|
+
obj = {"arguments": self._data, "steps": self._data[self._mode_sv.get()]["steps"]}
|
215
403
|
return obj
|
216
404
|
|
217
|
-
def
|
218
|
-
self.
|
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['
|
415
|
+
result['hyperparameters'] = []
|
416
|
+
result['service_parameters'] = []
|
227
417
|
result['service_parameters'] = {}
|
228
|
-
result['project_data'] = self.
|
229
|
-
for key, value in self.
|
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 == "
|
241
|
-
#result['
|
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['
|
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
|