mg-pso-gui 0.1.20__py3-none-any.whl → 0.1.21__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.21
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=1WTBEhe6KRujPgNb-NwRhFGDbAmP2Zayx3Pp6FHHwD0,22313
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.21.dist-info/METADATA,sha256=yTHYuuaKMSXJBLT20CXrqxbDOjxdIRAO6mdUbCEh1cU,9458
48
+ mg_pso_gui-0.1.21.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
49
+ mg_pso_gui-0.1.21.dist-info/entry_points.txt,sha256=jg82VOFjR1XDGrchs1wJSCqKYE4Ozv12aBcCSp--koA,117
50
+ mg_pso_gui-0.1.21.dist-info/top_level.txt,sha256=y7JuS9xJN5YdxUsQ3PSVjN8MzQAnR146bP3ZN3PYWdE,9
51
+ mg_pso_gui-0.1.21.dist-info/RECORD,,
mgpsogui/gui/HomePage.py CHANGED
@@ -267,13 +267,15 @@ class App(customtkinter.CTk):
267
267
  if "service_parameters" in metrics:
268
268
  self.option_manager.set_service_parameters(metrics["service_parameters"])
269
269
  self.tabview.configure(state="enabled")
270
-
270
+
271
271
  if "calibration_progress" in metrics:
272
272
  self.progress_data = pd.read_json(metrics["calibration_progress"])
273
273
  self.calibration_data = metrics["calibration_data"]
274
-
274
+ print(self.progress_data)
275
+
275
276
  if "calibration_data" in metrics:
276
277
  self.calibration_data = metrics["calibration_data"]
278
+ print(self.calibration_data)
277
279
 
278
280
  print(metrics)
279
281
 
@@ -347,6 +349,9 @@ class App(customtkinter.CTk):
347
349
  metrics = self.option_manager.get_metrics()
348
350
  self.running_config = metrics
349
351
 
352
+ self.progress_data = None
353
+ self.calibration_data = None
354
+
350
355
  #self.progress_bar.configure(mode="indeterminnate")
351
356
  #self.progress_bar.start()
352
357
  self.footer_progress_bar.configure(mode="indeterminnate")
@@ -364,6 +369,15 @@ class App(customtkinter.CTk):
364
369
  try:
365
370
  info = self.option_manager.get_project_data()
366
371
  folder = os.path.join(info['path'], info['name'])
372
+
373
+ if not os.path.exists(folder):
374
+ os.makedirs(folder)
375
+
376
+ if (os.path.exists(os.path.join(folder, 'output.txt'))):
377
+ os.remove(os.path.join(folder, 'output.txt'))
378
+
379
+ if (os.path.exists(os.path.join(folder, 'error.txt'))):
380
+ os.remove(os.path.join(folder, 'error.txt'))
367
381
 
368
382
  self.train_process = Process(target=PSORunner.run_process, args=(stdout_queue, stderr_queue, results_queue, cosu_queue, metrics, folder))
369
383
  self.train_process.daemon = True
@@ -420,7 +434,6 @@ class App(customtkinter.CTk):
420
434
 
421
435
  def watch_loop(self):
422
436
  # Check if file exists:
423
-
424
437
  info = self.option_manager.get_project_data()
425
438
  folder = os.path.join(info['path'], info['name'])
426
439
 
@@ -492,11 +505,11 @@ class App(customtkinter.CTk):
492
505
  progress_values = [tuple(map(float, i)) for i in progress_values]
493
506
 
494
507
  #print("Current params: " + str(calibrated_params), flush=True)
495
-
508
+
496
509
  self.calibration_data = calibrated_params
497
510
 
498
511
  #GraphGenerator.calibrated_params_by_round(self.running_config['steps'], calibrated_params, self.option_manager)
499
- self.update_graph("")
512
+ #self.update_graph("")
500
513
  except Exception as e:
501
514
  # Print stack trace
502
515
  traceback.print_exc()
@@ -523,12 +536,6 @@ class App(customtkinter.CTk):
523
536
  df = df.drop_duplicates(subset=['completed_rounds', 'round_step'])
524
537
  self.progress_data = df
525
538
 
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
539
  match = matches[-1]
533
540
  percent = int(match[0])
534
541
  completed_rounds = int(match[1])
@@ -561,18 +568,6 @@ class App(customtkinter.CTk):
561
568
  if self.train_process.is_alive():
562
569
  self.after(1000, self.watch_loop)
563
570
  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
571
  #self.progress_bar.stop()
577
572
  self.footer_progress_bar.stop()
578
573
  #self.progress_bar.configure(mode="indeterminate")
@@ -584,6 +579,9 @@ class App(customtkinter.CTk):
584
579
  self.progress_message_right.configure(text="")
585
580
  self.textbox.insert("0.0", "\nCalibration finished!\n")
586
581
 
582
+ GraphGenerator.generate_graphs(self)
583
+
584
+
587
585
  def start():
588
586
  app = App()
589
587
  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()