mg-pso-gui 0.1.115__py3-none-any.whl → 0.1.118__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mg_pso_gui-0.1.115.dist-info → mg_pso_gui-0.1.118.dist-info}/METADATA +1 -1
- {mg_pso_gui-0.1.115.dist-info → mg_pso_gui-0.1.118.dist-info}/RECORD +8 -8
- mgpsogui/gui/HomePage.py +20 -87
- mgpsogui/util/PSORunner.py +2 -2
- mgpsogui/util/sampler_test_driver.py +2 -0
- {mg_pso_gui-0.1.115.dist-info → mg_pso_gui-0.1.118.dist-info}/WHEEL +0 -0
- {mg_pso_gui-0.1.115.dist-info → mg_pso_gui-0.1.118.dist-info}/entry_points.txt +0 -0
- {mg_pso_gui-0.1.115.dist-info → mg_pso_gui-0.1.118.dist-info}/top_level.txt +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
mgpsogui/__init__.py,sha256=q7AfBjeJABnFtbsZnsObpUwaXKPDVYtz46G6MKXLF74,42
|
|
2
2
|
mgpsogui/mgpsogui.py,sha256=NIZmyNcbwC8EgSwf1ubdMUSJscrIEgoD4jLYziqHQ-k,148
|
|
3
3
|
mgpsogui/start.yaml,sha256=ZjCVLb-MLqAxrGRm9kA7_SDpa-45EuKIELNQ2QqCAiU,4713
|
|
4
|
-
mgpsogui/gui/HomePage.py,sha256=
|
|
4
|
+
mgpsogui/gui/HomePage.py,sha256=AqSNY9NDdIVcjNKtu4aAKbQiWPXWzHSH9tJNVq_zjsE,22562
|
|
5
5
|
mgpsogui/gui/OptionManager.py,sha256=H5ofd7PA5f6dVfSghUhKdPiqLHNE0IVpPPzf93k7JD4,12527
|
|
6
6
|
mgpsogui/gui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
7
|
mgpsogui/gui/PlatformTab/PlatformTab.py,sha256=KyIoHlMKD9nfQqHeGJwRDA4RCoe4UykjB2l6xMTKK_M,10486
|
|
@@ -33,11 +33,11 @@ mgpsogui/gui/images/test.png,sha256=MUnVpRK-isxhEHzx4Q6Yh0M6FRZD1qvgCHH2XmiSBbk,
|
|
|
33
33
|
mgpsogui/gui/images/trash.png,sha256=j8cf0kWbJd-4Jp20lUVV1o1NSeQ4v1Ej4gfcIA3DVRQ,2958
|
|
34
34
|
mgpsogui/gui/images/up.png,sha256=AQvFWCUqSQNaQ1E6LKZ9zNfSvW6t4mgy8uswdg9T2Hg,2457
|
|
35
35
|
mgpsogui/util/GraphGenerator.py,sha256=HhUsFUFhCv3wTYV8CTqU0wo56Ph9c1DocPj25AVIAdI,15076
|
|
36
|
-
mgpsogui/util/PSORunner.py,sha256=
|
|
36
|
+
mgpsogui/util/PSORunner.py,sha256=ZXFpfL1U8PxRwMDtuHmXHdJclzounq0mCJ0YOVEBtm4,3934
|
|
37
37
|
mgpsogui/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
38
38
|
mgpsogui/util/debug.py,sha256=36oZ3wf3_zGQbdZLGwHJ1Kk8QArl9pjNqkIaz6IPt74,19742
|
|
39
39
|
mgpsogui/util/helpers.py,sha256=fCfVDaGholx16FVVqf2BhWs9KCevI7aFIve1w2W68EQ,769
|
|
40
|
-
mgpsogui/util/sampler_test_driver.py,sha256=
|
|
40
|
+
mgpsogui/util/sampler_test_driver.py,sha256=1iJTLVFZ_VCsuIdl3mXQBA1GNAH5jJO3z5h4E_bd5U8,3703
|
|
41
41
|
mgpsogui/util/CTkToolTip/__init__.py,sha256=G1jxV55hGtGgwyC1sR-uUUdasDdh0XZgcI-aILgGYA0,225
|
|
42
42
|
mgpsogui/util/CTkToolTip/ctk_tooltip.py,sha256=SZMovpQIGvdpDRbqCKl9SHs92DrFCO2MOYL2ifolvOE,6329
|
|
43
43
|
mgpsogui/util/recosu/__init__.py,sha256=T7_iigIlowGbPOHLO3hwihjw2kbwIg6olOMhFhNiL38,236
|
|
@@ -49,8 +49,8 @@ mgpsogui/util/recosu/utils/trace_writer.py,sha256=V9BJlOjCbNYGoXGEk3CF5wjifBxvar
|
|
|
49
49
|
mgpsogui/util/recosu/utils/utils.py,sha256=QB8vftq3142ekG0ORjz0ZBHU5YknXbR0oTsrxrPAsF0,3951
|
|
50
50
|
mgpsogui/util/recosu/utils/plot/__init__.py,sha256=h1KjM7_tNDv351pcwt8A6Ibb1jhwWyx5Gbu-zj-sI3Q,71
|
|
51
51
|
mgpsogui/util/recosu/utils/plot/cost_steps.py,sha256=1Ce11AJyweWkmvjXPxEygzS-h8yVLmQEDLS53yjPLqQ,3779
|
|
52
|
-
mg_pso_gui-0.1.
|
|
53
|
-
mg_pso_gui-0.1.
|
|
54
|
-
mg_pso_gui-0.1.
|
|
55
|
-
mg_pso_gui-0.1.
|
|
56
|
-
mg_pso_gui-0.1.
|
|
52
|
+
mg_pso_gui-0.1.118.dist-info/METADATA,sha256=HecEFv_X6j2ia2lewYOJapHllNStBybzS3PAXrXhpN8,9460
|
|
53
|
+
mg_pso_gui-0.1.118.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
54
|
+
mg_pso_gui-0.1.118.dist-info/entry_points.txt,sha256=jg82VOFjR1XDGrchs1wJSCqKYE4Ozv12aBcCSp--koA,117
|
|
55
|
+
mg_pso_gui-0.1.118.dist-info/top_level.txt,sha256=y7JuS9xJN5YdxUsQ3PSVjN8MzQAnR146bP3ZN3PYWdE,9
|
|
56
|
+
mg_pso_gui-0.1.118.dist-info/RECORD,,
|
mgpsogui/gui/HomePage.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/local/bin/python3.
|
|
1
|
+
#!/usr/local/bin/python3.10
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
4
|
import time
|
|
@@ -55,7 +55,6 @@ customtkinter.set_default_color_theme("blue") # Themes: "blue" (standard), "gre
|
|
|
55
55
|
results_queue = Queue()
|
|
56
56
|
stdout_queue = Queue()
|
|
57
57
|
stderr_queue = Queue()
|
|
58
|
-
cosu_queue = Queue()
|
|
59
58
|
|
|
60
59
|
class App(customtkinter.CTk):
|
|
61
60
|
def __init__(self):
|
|
@@ -70,7 +69,7 @@ class App(customtkinter.CTk):
|
|
|
70
69
|
self.selected_csv.set("No files found...")
|
|
71
70
|
self.open_file = "None"
|
|
72
71
|
self.csv_data = None
|
|
73
|
-
|
|
72
|
+
|
|
74
73
|
self.selected_csv2 = tk.StringVar()
|
|
75
74
|
self.selected_csv2.set("No files found...")
|
|
76
75
|
self.open_file2 = "None"
|
|
@@ -99,7 +98,7 @@ class App(customtkinter.CTk):
|
|
|
99
98
|
self.progress_data = None
|
|
100
99
|
self.calibration_data = None
|
|
101
100
|
self.testing = False
|
|
102
|
-
|
|
101
|
+
|
|
103
102
|
# configure window
|
|
104
103
|
self.title("CSIP PSO")
|
|
105
104
|
self.geometry(f"{1920}x{1080}")
|
|
@@ -130,18 +129,22 @@ class App(customtkinter.CTk):
|
|
|
130
129
|
self.refresh_button = customtkinter.CTkButton(self.sidebar_frame, text=None, width=30, image=refresh_image, command=self.load)
|
|
131
130
|
ctt(self.refresh_button, delay=0.1, alpha=0.95, message="Connect to Service")
|
|
132
131
|
self.refresh_button.grid(row=0, column=5, padx=(5, 80), pady=header_padding_y)
|
|
132
|
+
|
|
133
|
+
self.algorithm_optionmenu = customtkinter.CTkOptionMenu(self.sidebar_frame, variable=self.option_manager.get_arguments()['mode'], values=["Optimization: MG-PSO", "Sampling: Halton", "Sampling: Random"], width=50, command=self.refresh_step_view)
|
|
134
|
+
self.algorithm_optionmenu.grid(row=0, column=6, padx=header_padding_x, pady=header_padding_y)
|
|
135
|
+
self.algorithm_optionmenu.set("Optimization: MG-PSO")
|
|
133
136
|
|
|
134
137
|
self.scaling_label = customtkinter.CTkLabel(self.sidebar_frame, text="Scale:", anchor="w")
|
|
135
|
-
self.scaling_label.grid(row=0, column=
|
|
138
|
+
self.scaling_label.grid(row=0, column=7, padx=header_padding_x, pady=header_padding_y)
|
|
136
139
|
self.scaling_optionemenu = customtkinter.CTkOptionMenu(self.sidebar_frame, values=["50%", "75%", "100%", "125%", "150%", "175%", "200%"], width=60,
|
|
137
|
-
|
|
138
|
-
self.scaling_optionemenu.grid(row=0, column=
|
|
140
|
+
command=self.change_scaling_event)
|
|
141
|
+
self.scaling_optionemenu.grid(row=0, column=8, padx=header_padding_x, pady=header_padding_y)
|
|
139
142
|
self.scaling_optionemenu.set("100%")
|
|
140
143
|
|
|
141
144
|
expand_image = customtkinter.CTkImage(Image.open(os.path.join("./images", "expand.png")), size=(20, 20))
|
|
142
145
|
self.new_window = customtkinter.CTkButton(self.sidebar_frame, text=None, width=30, image=expand_image, command=self.open_new_window)
|
|
143
146
|
ctt(self.new_window, delay=0.1, alpha=0.95, message="Open New Window")
|
|
144
|
-
self.new_window.grid(row=0, column=
|
|
147
|
+
self.new_window.grid(row=0, column=9, padx=(5, 20), pady=header_padding_y)
|
|
145
148
|
|
|
146
149
|
self.tabview = customtkinter.CTkTabview(self, bg_color="transparent", fg_color="transparent")
|
|
147
150
|
self.tabview.grid(row=1, column=0, padx=(0, 0), pady=(10, 10), sticky="nsew")
|
|
@@ -149,15 +152,11 @@ class App(customtkinter.CTk):
|
|
|
149
152
|
tab2 = "Setup"
|
|
150
153
|
tab3 = "Logs"
|
|
151
154
|
tab4 = "Results"
|
|
152
|
-
#tab5 = "Results"
|
|
153
155
|
|
|
154
156
|
self.tabview.add(tab1)
|
|
155
157
|
self.tabview.add(tab2)
|
|
156
158
|
self.tabview.add(tab4)
|
|
157
159
|
self.tabview.add(tab3)
|
|
158
|
-
#self.tabview.add(tab5)
|
|
159
|
-
|
|
160
|
-
#self.tabview.configure(state="disabled")
|
|
161
160
|
|
|
162
161
|
pt.create_tab(self, self.tabview.tab(tab1))
|
|
163
162
|
st.create_tab(self, self.tabview.tab(tab2))
|
|
@@ -174,10 +173,6 @@ class App(customtkinter.CTk):
|
|
|
174
173
|
self.footer_progress_bar = customtkinter.CTkProgressBar(self.footer_frame)
|
|
175
174
|
self.footer_progress_bar.grid(row=0, column=4, padx=(50, 100), pady=header_padding_y, sticky="ew")
|
|
176
175
|
self.footer_progress_bar.set(0)
|
|
177
|
-
|
|
178
|
-
self.algorithm_optionmenu = customtkinter.CTkOptionMenu(self.footer_frame, variable=self.option_manager.get_arguments()['mode'], values=["PSO", "Halton"], width=50, command=self.refresh_step_view)
|
|
179
|
-
self.algorithm_optionmenu.grid(row=0, column=6, padx=header_padding_x, pady=header_padding_y)
|
|
180
|
-
self.algorithm_optionmenu.set("PSO")
|
|
181
176
|
|
|
182
177
|
play_image = customtkinter.CTkImage(Image.open(os.path.join("./images", "play.png")), size=(20, 20))
|
|
183
178
|
self.run_button = customtkinter.CTkButton(self.footer_frame, text=None, width=30, image=play_image, command=self.run)
|
|
@@ -204,55 +199,10 @@ class App(customtkinter.CTk):
|
|
|
204
199
|
def update_graph(self, value):
|
|
205
200
|
self.vis_sidebar.refresh()
|
|
206
201
|
GraphGenerator.generate_graphs(self)
|
|
207
|
-
|
|
208
|
-
'''def _resize_image(self, event):
|
|
209
|
-
self.graph_label.update_idletasks()
|
|
210
|
-
new_width = self.graph_label.winfo_width()
|
|
211
|
-
new_height = self.graph_label.winfo_height()
|
|
212
|
-
|
|
213
|
-
alt_width = new_height * 1.77778
|
|
214
|
-
alt_height = new_width / 1.77778
|
|
215
|
-
|
|
216
|
-
if (new_width < new_height):
|
|
217
|
-
new_height = alt_height
|
|
218
|
-
else:
|
|
219
|
-
new_width = alt_width
|
|
220
|
-
|
|
221
|
-
self.image_width = new_width
|
|
222
|
-
self.image_height = new_height
|
|
223
|
-
|
|
224
|
-
self.graph_image = customtkinter.CTkImage(self.graph_image_obj, size=(new_width, new_height))
|
|
225
|
-
self.graph_label.configure(image=self.graph_image)
|
|
226
|
-
self.graph_label.update_idletasks()
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
def update_graph(self, value):
|
|
230
|
-
selected_graph = self.graph_selector_value.get()
|
|
231
|
-
info = self.option_manager.get_project_data()
|
|
232
|
-
folder = os.path.join(info['path'], info['name'])
|
|
233
|
-
|
|
234
|
-
if not os.path.exists(folder):
|
|
235
|
-
os.makedirs(folder)
|
|
236
|
-
|
|
237
|
-
if (selected_graph == "Best Cost Stacked"):
|
|
238
|
-
self.selected_graph_name = "best_cost_stacked"
|
|
239
|
-
elif (selected_graph == "Best Cost by Round"):
|
|
240
|
-
self.selected_graph_name = "best_cost_by_round"
|
|
241
|
-
elif (selected_graph == "Iteration Table"):
|
|
242
|
-
self.selected_graph_name = "table"
|
|
243
|
-
elif (selected_graph == "Calibrated Parameters"):
|
|
244
|
-
self.selected_graph_name = "calibrated_params_by_round"
|
|
245
|
-
|
|
246
|
-
image_path = os.path.join(folder, self.selected_graph_name + ".png")
|
|
247
|
-
if not os.path.exists(image_path):
|
|
248
|
-
image_path = os.path.join("./images", "up.png")
|
|
249
|
-
self.graph_image_obj = Image.open(image_path)
|
|
250
|
-
self.graph_image = customtkinter.CTkImage(self.graph_image_obj, size=(self.image_width * self.image_scale, self.image_height * self.image_scale))
|
|
251
|
-
self.graph_label.configure(image=self.graph_image)'''
|
|
252
202
|
|
|
253
203
|
def save_project(self):
|
|
254
204
|
metrics = self.option_manager.get_metrics()
|
|
255
|
-
|
|
205
|
+
|
|
256
206
|
# Add the calibration_progress dataframe to the json
|
|
257
207
|
if (self.progress_data is not None):
|
|
258
208
|
metrics["calibration_progress"] = self.progress_data.to_json()
|
|
@@ -280,7 +230,7 @@ class App(customtkinter.CTk):
|
|
|
280
230
|
self.steps_frame.render()
|
|
281
231
|
self.optimal_param_frame.clear()
|
|
282
232
|
self.optimal_param_frame.render()
|
|
283
|
-
|
|
233
|
+
|
|
284
234
|
def open_new_window(self):
|
|
285
235
|
# Shell out and run ./main.py
|
|
286
236
|
subprocess.Popen(["python3", "../mgpsogui.py"])
|
|
@@ -390,7 +340,7 @@ class App(customtkinter.CTk):
|
|
|
390
340
|
def run_test(self):
|
|
391
341
|
self.testing = True
|
|
392
342
|
self.run()
|
|
393
|
-
|
|
343
|
+
|
|
394
344
|
def run(self):
|
|
395
345
|
metrics = self.option_manager.get_metrics()
|
|
396
346
|
self.running_config = metrics
|
|
@@ -401,7 +351,7 @@ class App(customtkinter.CTk):
|
|
|
401
351
|
for param in step['param']:
|
|
402
352
|
param['default_value'] = param['optimal_value']
|
|
403
353
|
self.testing = False
|
|
404
|
-
|
|
354
|
+
|
|
405
355
|
self.progress_data = None
|
|
406
356
|
self.calibration_data = None
|
|
407
357
|
|
|
@@ -432,7 +382,7 @@ class App(customtkinter.CTk):
|
|
|
432
382
|
if (os.path.exists(os.path.join(folder, 'error.txt'))):
|
|
433
383
|
os.remove(os.path.join(folder, 'error.txt'))
|
|
434
384
|
|
|
435
|
-
self.train_process = Process(target=PSORunner.run_process, args=(stdout_queue, stderr_queue, results_queue,
|
|
385
|
+
self.train_process = Process(target=PSORunner.run_process, args=(stdout_queue, stderr_queue, results_queue, metrics, folder))
|
|
436
386
|
self.train_process.daemon = True
|
|
437
387
|
self.train_process.start()
|
|
438
388
|
self.after(1000, self.watch_loop)
|
|
@@ -508,38 +458,28 @@ class App(customtkinter.CTk):
|
|
|
508
458
|
print("# " + stdout_line, flush=True)
|
|
509
459
|
with open(os.path.join(folder, 'output.txt'), 'a') as f:
|
|
510
460
|
f.write(stdout_line)
|
|
511
|
-
|
|
512
461
|
except Empty:
|
|
513
462
|
break
|
|
514
463
|
|
|
515
464
|
while True:
|
|
516
465
|
try:
|
|
517
466
|
stderr_line = stderr_queue.get_nowait()
|
|
518
|
-
|
|
519
467
|
print("? " + stderr_line, flush=True)
|
|
520
468
|
with open(os.path.join(folder, 'error.txt'), 'a') as f:
|
|
521
469
|
f.write(stderr_line)
|
|
522
470
|
|
|
523
471
|
except Empty:
|
|
524
472
|
break
|
|
525
|
-
|
|
526
|
-
while True:
|
|
527
|
-
try:
|
|
528
|
-
cosu_line = cosu_queue.get_nowait()
|
|
529
|
-
|
|
530
|
-
print("COSU " + cosu_line, flush=True)
|
|
531
|
-
except Empty:
|
|
532
|
-
break
|
|
533
473
|
|
|
534
474
|
while True:
|
|
535
475
|
try:
|
|
536
476
|
trace = results_queue.get_nowait()
|
|
537
477
|
|
|
538
478
|
print("TRACE " + str(trace), flush=True)
|
|
539
|
-
|
|
479
|
+
|
|
540
480
|
final_results = hp.extract_final_round_values(trace)
|
|
541
481
|
print("Final results: " + str(final_results), flush=True)
|
|
542
|
-
|
|
482
|
+
|
|
543
483
|
all_steps = self.option_manager.get_steps()
|
|
544
484
|
data = final_results["data"]
|
|
545
485
|
index = 0
|
|
@@ -552,14 +492,13 @@ class App(customtkinter.CTk):
|
|
|
552
492
|
target_param['optimal_value'].set(value)
|
|
553
493
|
index += 1
|
|
554
494
|
print("Applied optimal values")
|
|
555
|
-
|
|
556
|
-
|
|
557
495
|
except Empty:
|
|
558
496
|
break
|
|
559
497
|
except Exception as e:
|
|
560
498
|
print("Some error happened when getting the trace!")
|
|
561
499
|
print(e)
|
|
562
500
|
|
|
501
|
+
# Write output to textbox
|
|
563
502
|
if (os.path.exists(os.path.join(folder, 'output.txt'))):
|
|
564
503
|
with open(os.path.join(folder, 'output.txt'), 'r') as f:
|
|
565
504
|
lines = f.readlines()
|
|
@@ -572,6 +511,7 @@ class App(customtkinter.CTk):
|
|
|
572
511
|
print(new_characters, end="")
|
|
573
512
|
|
|
574
513
|
try:
|
|
514
|
+
# REPLACE THIS WITH READING THE STEP TRACE JSON for PSO
|
|
575
515
|
with open(os.path.join(folder, "output.txt"), "r") as f:
|
|
576
516
|
text = f.read()
|
|
577
517
|
|
|
@@ -593,17 +533,10 @@ class App(customtkinter.CTk):
|
|
|
593
533
|
calibrated_params = [ast.literal_eval(i) for i in calibrated_params]
|
|
594
534
|
best_particle_values = [ast.literal_eval(i) for i in best_particle_values]
|
|
595
535
|
progress_values = [tuple(map(float, i)) for i in progress_values]
|
|
596
|
-
|
|
597
|
-
#print("Current params: " + str(calibrated_params), flush=True)
|
|
598
|
-
|
|
599
536
|
self.calibration_data = calibrated_params
|
|
600
537
|
|
|
601
|
-
#GraphGenerator.calibrated_params_by_round(self.running_config['steps'], calibrated_params, self.option_manager)
|
|
602
|
-
#self.update_graph("")
|
|
603
538
|
except Exception as e:
|
|
604
|
-
# Print stack trace
|
|
605
539
|
traceback.print_exc()
|
|
606
|
-
|
|
607
540
|
print(e)
|
|
608
541
|
|
|
609
542
|
if (os.path.exists(os.path.join(folder, 'error.txt'))):
|
mgpsogui/util/PSORunner.py
CHANGED
|
@@ -14,7 +14,7 @@ def enqueue_output(out, queue):
|
|
|
14
14
|
queue.put(line)
|
|
15
15
|
out.close()
|
|
16
16
|
|
|
17
|
-
def run_process(stdout_queue, stderr_queue, results_queue,
|
|
17
|
+
def run_process(stdout_queue, stderr_queue, results_queue, data, folder):
|
|
18
18
|
steps = data['steps']
|
|
19
19
|
args = data['arguments']
|
|
20
20
|
calib = data['calibration_parameters']
|
|
@@ -73,7 +73,7 @@ def run_process(stdout_queue, stderr_queue, results_queue, cosu_queue, data, fol
|
|
|
73
73
|
'http_conn_timeout': int(calibration_map['conn_timeout']),
|
|
74
74
|
'http_read_timeout': int(calibration_map['read_timeout']),
|
|
75
75
|
'particles_fail': int(calibration_map['particles_fail']),
|
|
76
|
-
'step_trace': os.path.join(folder, '
|
|
76
|
+
'step_trace': os.path.join(folder, 'pso_step_trace.json')
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
print("\n")
|
|
@@ -119,6 +119,8 @@ def main():
|
|
|
119
119
|
|
|
120
120
|
trace = run_sampler(steps, args, 10, 2, "halton", conf=conf, trace_file="halton_trace.csv", offset=5)
|
|
121
121
|
print(trace)
|
|
122
|
+
|
|
123
|
+
|
|
122
124
|
trace = run_sampler(steps, args, 10, 2, "random", conf=conf, trace_file="random_trace.csv")
|
|
123
125
|
print(trace)
|
|
124
126
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|