mg-pso-gui 0.1.20__py3-none-any.whl → 0.1.22__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mg-pso-gui
3
- Version: 0.1.20
3
+ Version: 0.1.22
4
4
  Summary: GUI for MG-PSO
5
5
  Author: Robert Cordingly
6
6
  Author-email: <rcording@uw.ed>
@@ -1,12 +1,12 @@
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=T8Dm25HdI-cIXKCtxbLc6RMyRzgyaJuLhdtM3wWHLCo,22673
4
+ mgpsogui/gui/HomePage.py,sha256=jxrIwVJMMZ-RiFbAveMz6n0JaWev-S5lLwhQ_YEV8fQ,22539
5
5
  mgpsogui/gui/OptionManager.py,sha256=bFN2jWJbx1Din3waOFLmbWGt0BXD_KthGJ8Mgue_FEE,11712
6
6
  mgpsogui/gui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  mgpsogui/gui/PlatformTab/PlatformTab.py,sha256=KyIoHlMKD9nfQqHeGJwRDA4RCoe4UykjB2l6xMTKK_M,10486
8
8
  mgpsogui/gui/PlatformTab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- mgpsogui/gui/RunTab/RunTab.py,sha256=OjRteh5-ivHXRBam1M60JrxzkQEeqjstrUR93K25R8Y,2850
9
+ mgpsogui/gui/RunTab/RunTab.py,sha256=GPKhwCZh6FXhmRypPl0zo7XByM2AsBqeY3gxctANyP8,1839
10
10
  mgpsogui/gui/RunTab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  mgpsogui/gui/SetupTab/BoundsEditorWindow.py,sha256=_6_xEl46PY9MmNvpmoMNdNDbVav6ODwWSDROboy57Cs,2866
12
12
  mgpsogui/gui/SetupTab/BoundsList.py,sha256=L77UEaUJNiUE-ZsYIl44tWRb1zBfxaEQ-bAG1V5_IH0,12268
@@ -30,7 +30,7 @@ mgpsogui/gui/images/stop.png,sha256=JPuxXQerCGpLikcp7cAj3iLCOjULMYYZ2sZe0lArh68,
30
30
  mgpsogui/gui/images/test.png,sha256=MUnVpRK-isxhEHzx4Q6Yh0M6FRZD1qvgCHH2XmiSBbk,3642
31
31
  mgpsogui/gui/images/trash.png,sha256=j8cf0kWbJd-4Jp20lUVV1o1NSeQ4v1Ej4gfcIA3DVRQ,2958
32
32
  mgpsogui/gui/images/up.png,sha256=AQvFWCUqSQNaQ1E6LKZ9zNfSvW6t4mgy8uswdg9T2Hg,2457
33
- mgpsogui/util/GraphGenerator.py,sha256=6SK9pPH1dAM6nQbZs8L5W4HxWsI5B35MDN2D46fSIVU,7917
33
+ mgpsogui/util/GraphGenerator.py,sha256=DDP8bqdfGxPPbvTjyYYW5GiE5AV6Z_KfVbeqRCoWrz0,9266
34
34
  mgpsogui/util/PSORunner.py,sha256=wfkrZLysgSS_5BrdFEm8U-0S7DHYpxmHPau_Ec5W8ak,4510
35
35
  mgpsogui/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
36
  mgpsogui/util/CTkToolTip/__init__.py,sha256=G1jxV55hGtGgwyC1sR-uUUdasDdh0XZgcI-aILgGYA0,225
@@ -44,8 +44,8 @@ mgpsogui/util/recosu/utils/trace_writer.py,sha256=V9BJlOjCbNYGoXGEk3CF5wjifBxvar
44
44
  mgpsogui/util/recosu/utils/utils.py,sha256=QB8vftq3142ekG0ORjz0ZBHU5YknXbR0oTsrxrPAsF0,3951
45
45
  mgpsogui/util/recosu/utils/plot/__init__.py,sha256=h1KjM7_tNDv351pcwt8A6Ibb1jhwWyx5Gbu-zj-sI3Q,71
46
46
  mgpsogui/util/recosu/utils/plot/cost_steps.py,sha256=1Ce11AJyweWkmvjXPxEygzS-h8yVLmQEDLS53yjPLqQ,3779
47
- mg_pso_gui-0.1.20.dist-info/METADATA,sha256=MvH-AzMYnHi1vR0utPAAJwDVY6tLYm2PPBA1fM5DLSo,9458
48
- mg_pso_gui-0.1.20.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
49
- mg_pso_gui-0.1.20.dist-info/entry_points.txt,sha256=jg82VOFjR1XDGrchs1wJSCqKYE4Ozv12aBcCSp--koA,117
50
- mg_pso_gui-0.1.20.dist-info/top_level.txt,sha256=y7JuS9xJN5YdxUsQ3PSVjN8MzQAnR146bP3ZN3PYWdE,9
51
- mg_pso_gui-0.1.20.dist-info/RECORD,,
47
+ mg_pso_gui-0.1.22.dist-info/METADATA,sha256=1psPUPAnPydj8ytjyCQEFpkoozgetX8XBCPcefeNpSQ,9458
48
+ mg_pso_gui-0.1.22.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
49
+ mg_pso_gui-0.1.22.dist-info/entry_points.txt,sha256=jg82VOFjR1XDGrchs1wJSCqKYE4Ozv12aBcCSp--koA,117
50
+ mg_pso_gui-0.1.22.dist-info/top_level.txt,sha256=y7JuS9xJN5YdxUsQ3PSVjN8MzQAnR146bP3ZN3PYWdE,9
51
+ mg_pso_gui-0.1.22.dist-info/RECORD,,
mgpsogui/gui/HomePage.py CHANGED
@@ -175,6 +175,8 @@ class App(customtkinter.CTk):
175
175
  ctt(self.download_button, delay=0.1, alpha=0.95, message="Download Results")
176
176
  self.download_button.grid(row=0, column=10, padx=(5, 20), pady=header_padding_y)
177
177
 
178
+ self.after(1000, self.running_loop)
179
+
178
180
  '''def _resize_image(self, event):
179
181
  self.graph_label.update_idletasks()
180
182
  new_width = self.graph_label.winfo_width()
@@ -267,13 +269,15 @@ class App(customtkinter.CTk):
267
269
  if "service_parameters" in metrics:
268
270
  self.option_manager.set_service_parameters(metrics["service_parameters"])
269
271
  self.tabview.configure(state="enabled")
270
-
272
+
271
273
  if "calibration_progress" in metrics:
272
274
  self.progress_data = pd.read_json(metrics["calibration_progress"])
273
275
  self.calibration_data = metrics["calibration_data"]
274
-
276
+ print(self.progress_data)
277
+
275
278
  if "calibration_data" in metrics:
276
279
  self.calibration_data = metrics["calibration_data"]
280
+ print(self.calibration_data)
277
281
 
278
282
  print(metrics)
279
283
 
@@ -347,6 +351,9 @@ class App(customtkinter.CTk):
347
351
  metrics = self.option_manager.get_metrics()
348
352
  self.running_config = metrics
349
353
 
354
+ self.progress_data = None
355
+ self.calibration_data = None
356
+
350
357
  #self.progress_bar.configure(mode="indeterminnate")
351
358
  #self.progress_bar.start()
352
359
  self.footer_progress_bar.configure(mode="indeterminnate")
@@ -364,6 +371,15 @@ class App(customtkinter.CTk):
364
371
  try:
365
372
  info = self.option_manager.get_project_data()
366
373
  folder = os.path.join(info['path'], info['name'])
374
+
375
+ if not os.path.exists(folder):
376
+ os.makedirs(folder)
377
+
378
+ if (os.path.exists(os.path.join(folder, 'output.txt'))):
379
+ os.remove(os.path.join(folder, 'output.txt'))
380
+
381
+ if (os.path.exists(os.path.join(folder, 'error.txt'))):
382
+ os.remove(os.path.join(folder, 'error.txt'))
367
383
 
368
384
  self.train_process = Process(target=PSORunner.run_process, args=(stdout_queue, stderr_queue, results_queue, cosu_queue, metrics, folder))
369
385
  self.train_process.daemon = True
@@ -418,9 +434,18 @@ class App(customtkinter.CTk):
418
434
  self.footer_progress_label.configure(text="Stopped")
419
435
  self.progress_message_right.configure(text="")
420
436
 
437
+ def running_loop(self):
438
+ try:
439
+ active_tab = self.tabview.get()
440
+ if (active_tab == "Results"):
441
+ GraphGenerator.generate_graphs(self)
442
+ else:
443
+ print(active_tab)
444
+ finally:
445
+ self.after(1000, self.running_loop)
446
+
421
447
  def watch_loop(self):
422
448
  # Check if file exists:
423
-
424
449
  info = self.option_manager.get_project_data()
425
450
  folder = os.path.join(info['path'], info['name'])
426
451
 
@@ -492,11 +517,11 @@ class App(customtkinter.CTk):
492
517
  progress_values = [tuple(map(float, i)) for i in progress_values]
493
518
 
494
519
  #print("Current params: " + str(calibrated_params), flush=True)
495
-
520
+
496
521
  self.calibration_data = calibrated_params
497
522
 
498
523
  #GraphGenerator.calibrated_params_by_round(self.running_config['steps'], calibrated_params, self.option_manager)
499
- self.update_graph("")
524
+ #self.update_graph("")
500
525
  except Exception as e:
501
526
  # Print stack trace
502
527
  traceback.print_exc()
@@ -523,12 +548,6 @@ class App(customtkinter.CTk):
523
548
  df = df.drop_duplicates(subset=['completed_rounds', 'round_step'])
524
549
  self.progress_data = df
525
550
 
526
- #GraphGenerator.update_progress_graphs(self.running_config['steps'], self.current_data, self.option_manager)
527
- #GraphGenerator.best_cost_stacked(self.running_config['steps'], df, self.option_manager)
528
- #GraphGenerator.best_cost_by_round(self.running_config['steps'], df, self.option_manager)
529
- #GraphGenerator.table(self.running_config['steps'], df, self.option_manager)
530
- #self.update_graph("")
531
-
532
551
  match = matches[-1]
533
552
  percent = int(match[0])
534
553
  completed_rounds = int(match[1])
@@ -561,18 +580,6 @@ class App(customtkinter.CTk):
561
580
  if self.train_process.is_alive():
562
581
  self.after(1000, self.watch_loop)
563
582
  else:
564
- # Check if queue is empty
565
- """
566
- if (self.process_queue.empty()):
567
- print("PROCESS FINISHED BUT WE GOT NO OBJECTS :(")
568
- self.footer_progress_label.configure(text="Failed")
569
- else:
570
- self.final_results = self.process_queue.get()
571
- print("PROCESS FINISHED WE GOT THINGS")
572
- print(self.final_results)
573
- self.footer_progress_label.configure(text="Finished")
574
- """
575
-
576
583
  #self.progress_bar.stop()
577
584
  self.footer_progress_bar.stop()
578
585
  #self.progress_bar.configure(mode="indeterminate")
@@ -584,6 +591,9 @@ class App(customtkinter.CTk):
584
591
  self.progress_message_right.configure(text="")
585
592
  self.textbox.insert("0.0", "\nCalibration finished!\n")
586
593
 
594
+
595
+
596
+
587
597
  def start():
588
598
  app = App()
589
599
  app.mainloop()
@@ -19,21 +19,7 @@ def create_tab(self, tab):
19
19
  tab.grid_columnconfigure(0, weight=1)
20
20
  tab.grid_rowconfigure(0, weight=1)
21
21
  tab.grid_rowconfigure(1, weight=200)
22
-
23
- """
24
- self.url = customtkinter.CTkEntry(tab, textvariable=self.option_manager.get_arguments()['url'])
25
- self.url.grid(row=0, column=0, columnspan=1, padx=(20, 20), pady=(20, 20), sticky="nsew")
26
22
 
27
- self.run_button = customtkinter.CTkButton(tab, text="Run", command=self.run)
28
- self.run_button.grid(row=0, column=1, padx=(20, 20), pady=(20, 20), sticky="nsew")
29
- ctt(self.run_button, delay=0.5, message="Start calibration...")
30
-
31
- self.stop_button = customtkinter.CTkButton(tab, text="Stop", command=self.stop)
32
- self.stop_button.grid(row=0, column=2, padx=(20, 20), pady=(20, 20), sticky="nsew")
33
- ctt(self.stop_button, delay=0.5, message="Stop calibration...")
34
-
35
- """
36
-
37
23
  self.progress_container = customtkinter.CTkFrame(tab)
38
24
  self.progress_container.grid_columnconfigure(0, weight=1)
39
25
  self.progress_container.grid_columnconfigure(1, weight=1)
@@ -50,12 +36,7 @@ def create_tab(self, tab):
50
36
  self.progress_message_right = customtkinter.CTkLabel(self.progress_container, text="")
51
37
  self.progress_message_right.grid(row=0, column=2, padx=(10, 10), pady=(10, 10), sticky="e")
52
38
 
53
- #self.progress_bar = customtkinter.CTkProgressBar(self.progress_container)
54
- #self.progress_bar.grid(row=1, column=0, columnspan=3, padx=(10, 10), pady=(10, 10), sticky="ew")
55
- #self.progress_bar.set(0)
56
- #ctt(self.progress_bar, delay=0.5, message="Current calibration progress")
57
-
58
39
  self.textbox = customtkinter.CTkTextbox(tab)
59
40
  self.textbox.grid(row=1, column=0, padx=(20, 20), pady=(20, 20), sticky="nsew")
60
- self.textbox.insert("0.0", "Welcome to the CSIP PSO Calibration Tool!\n\nUse the Calibration tab to define steps and calibration parameters. Use this tab to run and observe calibration progress. Once finished, use the Visualization tab to generate figures and graphs.")
41
+ self.textbox.insert("0.0", "Welcome to the CSIP PSO Calibration Tool!\n\nUse the Setup tab to define steps and calibration parameters. Use this tab to view logs and observe calibration progress. Once finished, use the Results tab to generate figures and graphs.")
61
42
 
@@ -3,9 +3,34 @@ import plotly.graph_objs as go
3
3
  import pandas as pd
4
4
  import numpy as np
5
5
  import os
6
+ from PIL import Image, ImageTk
6
7
 
7
- def generate_graphs(config, dataframe, option_manager):
8
- pass
8
+ def generate_graphs(HomePage):
9
+ selected_graph = HomePage.graph_selector_value.get()
10
+ info = HomePage.option_manager.get_project_data()
11
+ folder = os.path.join(info['path'], info['name'])
12
+ if not os.path.exists(folder):
13
+ os.makedirs(folder)
14
+
15
+ if (selected_graph == "Best Cost Stacked"):
16
+ HomePage.selected_graph_name = "best_cost_stacked"
17
+ best_cost_stacked(HomePage.running_config['steps'], HomePage.progress_data, HomePage.option_manager)
18
+ elif (selected_graph == "Best Cost by Round"):
19
+ HomePage.selected_graph_name = "best_cost_by_round"
20
+ best_cost_by_round(HomePage.running_config['steps'], HomePage.progress_data, HomePage.option_manager)
21
+ elif (selected_graph == "Iteration Table"):
22
+ HomePage.selected_graph_name = "table"
23
+ table(HomePage.running_config['steps'], HomePage.progress_data, HomePage.option_manager)
24
+ elif (selected_graph == "Calibrated Parameters"):
25
+ HomePage.selected_graph_name = "calibrated_params_by_round"
26
+ calibrated_params_by_round(HomePage.running_config['steps'], HomePage.calibration_data, HomePage.option_manager)
27
+
28
+ image_path = os.path.join(folder, HomePage.selected_graph_name + ".png")
29
+
30
+ if not os.path.exists(image_path):
31
+ image_path = os.path.join("./images", "up.png")
32
+
33
+ HomePage.graph_image_obj = Image.open(image_path)
9
34
 
10
35
  def best_cost_stacked(config, dataframe, option_manager):
11
36
  fig = go.Figure()