mg-pso-gui 0.0.192__tar.gz → 0.0.194__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/PKG-INFO +1 -1
  2. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mg_pso_gui.egg-info/PKG-INFO +1 -1
  3. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/gui/HomePage.py +20 -3
  4. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/gui/VisualizeTab/VisualizeTab.py +2 -2
  5. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/util/GraphGenerator.py +1 -1
  6. mg-pso-gui-0.0.194/mgpsogui/util/PSORunner.py +179 -0
  7. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/setup.py +1 -1
  8. mg-pso-gui-0.0.192/mgpsogui/util/PSORunner.py +0 -72
  9. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mg_pso_gui.egg-info/SOURCES.txt +0 -0
  10. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mg_pso_gui.egg-info/dependency_links.txt +0 -0
  11. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mg_pso_gui.egg-info/entry_points.txt +0 -0
  12. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mg_pso_gui.egg-info/requires.txt +0 -0
  13. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mg_pso_gui.egg-info/top_level.txt +0 -0
  14. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/__init__.py +0 -0
  15. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/gui/OptionManager.py +0 -0
  16. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/gui/PlatformTab/PlatformTab.py +0 -0
  17. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/gui/PlatformTab/__init__.py +0 -0
  18. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/gui/RunTab/RunTab.py +0 -0
  19. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/gui/RunTab/__init__.py +0 -0
  20. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/gui/SetupTab/BoundsEditorWindow.py +0 -0
  21. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/gui/SetupTab/BoundsList.py +0 -0
  22. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/gui/SetupTab/CalibrationParametersView.py +0 -0
  23. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/gui/SetupTab/FunctionsList.py +0 -0
  24. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/gui/SetupTab/ListParametersView.py +0 -0
  25. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/gui/SetupTab/SetupTab.py +0 -0
  26. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/gui/SetupTab/StaticParameterView.py +0 -0
  27. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/gui/SetupTab/StepView.py +0 -0
  28. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/gui/SetupTab/__init__.py +0 -0
  29. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/gui/VisualizeTab/__init__.py +0 -0
  30. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/gui/__init__.py +0 -0
  31. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/gui/images/collapse.png +0 -0
  32. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/gui/images/down.png +0 -0
  33. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/gui/images/expand.png +0 -0
  34. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/gui/images/play.png +0 -0
  35. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/gui/images/refresh.png +0 -0
  36. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/gui/images/refresh_hd.png +0 -0
  37. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/gui/images/stop.png +0 -0
  38. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/gui/images/trash.png +0 -0
  39. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/gui/images/up.png +0 -0
  40. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/mgpsogui.py +0 -0
  41. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/start.yaml +0 -0
  42. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/util/CTkToolTip/__init__.py +0 -0
  43. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/util/CTkToolTip/ctk_tooltip.py +0 -0
  44. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/mgpsogui/util/__init__.py +0 -0
  45. {mg-pso-gui-0.0.192 → mg-pso-gui-0.0.194}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mg-pso-gui
3
- Version: 0.0.192
3
+ Version: 0.0.194
4
4
  Summary: GUI for MG-PSO
5
5
  Author: Robert Cordingly
6
6
  Author-email: <rcording@uw.ed>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mg-pso-gui
3
- Version: 0.0.192
3
+ Version: 0.0.194
4
4
  Summary: GUI for MG-PSO
5
5
  Author: Robert Cordingly
6
6
  Author-email: <rcording@uw.ed>
@@ -48,6 +48,10 @@ from ..util.CTkToolTip import CTkToolTip as ctt
48
48
  customtkinter.set_appearance_mode("Dark") # Modes: "System" (standard), "Dark", "Light"
49
49
  customtkinter.set_default_color_theme("blue") # Themes: "blue" (standard), "green", "dark-blue"
50
50
 
51
+ results_queue = Queue()
52
+ stdout_queue = Queue()
53
+ stderr_queue = Queue()
54
+
51
55
  class App(customtkinter.CTk):
52
56
  def __init__(self):
53
57
  super().__init__()
@@ -341,8 +345,7 @@ class App(customtkinter.CTk):
341
345
  info = self.option_manager.get_project_data()
342
346
  folder = os.path.join(info['path'], info['name'])
343
347
 
344
-
345
- self.train_process = Process(target=PSORunner.run_process, args=(metrics, folder))
348
+ self.train_process = Process(target=PSORunner.run_process, args=(stdout_queue, stderr_queue, results_queue, metrics, folder))
346
349
  self.train_process.daemon = True
347
350
  self.train_process.start()
348
351
  self.after(1000, self.watch_loop)
@@ -403,6 +406,11 @@ class App(customtkinter.CTk):
403
406
 
404
407
  if not os.path.exists(folder):
405
408
  os.makedirs(folder)
409
+
410
+ if (stdout_queue.qsize() > 0):
411
+ val = stdout_queue.get()
412
+ self.textbox.insert("0.0", val)
413
+ print(val)
406
414
 
407
415
  if (os.path.exists(os.path.join(folder, 'output.txt'))):
408
416
  with open(os.path.join(folder, 'output.txt'), 'r') as f:
@@ -504,6 +512,16 @@ class App(customtkinter.CTk):
504
512
  if self.train_process.is_alive():
505
513
  self.after(1000, self.watch_loop)
506
514
  else:
515
+ # Check if queue is empty
516
+ if (self.process_queue.empty()):
517
+ print("PROCESS FINISHED BUT WE GOT NO OBJECTS :(")
518
+ self.footer_progress_label.configure(text="Failed")
519
+ else:
520
+ self.final_results = self.process_queue.get()
521
+ print("PROCESS FINISHED WE GOT THINGS")
522
+ print(self.final_results)
523
+ self.footer_progress_label.configure(text="Finished")
524
+
507
525
  #self.progress_bar.stop()
508
526
  self.footer_progress_bar.stop()
509
527
  #self.progress_bar.configure(mode="indeterminate")
@@ -513,7 +531,6 @@ class App(customtkinter.CTk):
513
531
  self.progress_message_left.configure(text="")
514
532
  self.progress_message_middle.configure(text="Calibration finished!")
515
533
  self.progress_message_right.configure(text="")
516
- self.footer_progress_label.configure(text="Finished")
517
534
  self.textbox.insert("0.0", "\nCalibration finished!\n")
518
535
 
519
536
  def start():
@@ -61,11 +61,11 @@ def create_tab(self, tab):
61
61
 
62
62
  self.graph_selector_value = tk.StringVar()
63
63
  self.graph_selector_value.set("Best Cost Stacked")
64
- self.graph_selector = customtkinter.CTkOptionMenu(self.graph_sidebar, values=["Best Cost Stacked", "Best Cost by Round", "Calibrated Parameters", "Iteration Table"], variable=self.graph_selector_value, command=self.update_graph)
64
+ self.graph_selector = customtkinter.CTkOptionMenu(self.graph_sidebar, width=250, values=["Best Cost Stacked", "Best Cost by Round", "Calibrated Parameters", "Iteration Table"], variable=self.graph_selector_value, command=self.update_graph)
65
65
  self.graph_selector.grid(row=0, column=0, padx=(20, 20), pady=(20, 20), sticky="nsew")
66
66
 
67
67
  # Add a button to call open_graph_in_browser
68
- self.graph_button = customtkinter.CTkButton(self.graph_sidebar, text="Open Graph in Browser", command=open_graph_in_browser)
68
+ self.graph_button = customtkinter.CTkButton(self.graph_sidebar, text="Open in Browser", width=250, command=open_graph_in_browser)
69
69
  self.graph_button.grid(row=9, column=0, padx=(20, 20), pady=(20, 20), sticky="nsew")
70
70
 
71
71
  self.graph_image_obj = Image.open(os.path.join("./images", "refresh_hd.png"))
@@ -4,7 +4,7 @@ import pandas as pd
4
4
  import numpy as np
5
5
  import os
6
6
 
7
- def best_cost_stacked(config, dataframe, option_manager):
7
+ def best_coststacked(config, dataframe, option_manager):
8
8
  fig = go.Figure()
9
9
 
10
10
  total_steps = len(config)
@@ -0,0 +1,179 @@
1
+ import csip
2
+ import cosu
3
+ import sys
4
+ from multiprocessing import Process, Queue
5
+ from queue import Empty
6
+ import threading
7
+ import time
8
+ import os
9
+
10
+ from cosu.pso import global_best
11
+
12
+ def enqueue_output(out, queue):
13
+ for line in iter(out.readline, b''):
14
+ queue.put(line)
15
+ out.close()
16
+
17
+ def run_process(stdout_queue, stderr_queue, results_queue, data, folder):
18
+ steps = data['steps']
19
+ args = data['arguments']
20
+ calib = data['calibration_parameters']
21
+
22
+ calibration_map = {}
23
+ for param in calib:
24
+ param_name = param['name']
25
+ param_value = param['value']
26
+ calibration_map[param_name] = param_value
27
+
28
+ if not os.path.exists(folder):
29
+ os.makedirs(folder)
30
+
31
+ if (os.path.exists(os.path.join(folder, 'output.txt'))):
32
+ os.remove(os.path.join(folder, 'output.txt'))
33
+
34
+ if (os.path.exists(os.path.join(folder, 'error.txt'))):
35
+ os.remove(os.path.join(folder, 'error.txt'))
36
+
37
+ #sys.stdout = open(os.path.join(folder, 'output.txt'), 'w', buffering=1)
38
+ #sys.stderr = open(os.path.join(folder, 'error.txt'), 'w', buffering=1)
39
+
40
+ old_stdout = sys.stdout
41
+ old_stderr = sys.stderr
42
+
43
+ read_stdout, write_stdout = os.pipe()
44
+ read_stderr, write_stderr = os.pipe()
45
+
46
+ sys.stdout = os.fdopen(write_stdout, 'w')
47
+ sys.stderr = os.fdopen(write_stderr, 'w')
48
+
49
+ stdour_thread = threading.Thread(target=enqueue_output, args=(os.fdopen(read_stdout, 'r'), stdout_queue))
50
+ stderr_thread = threading.Thread(target=enqueue_output, args=(os.fdopen(read_stderr, 'r'), stderr_queue))
51
+ stdour_thread.daemon = True
52
+ stderr_thread.daemon = True
53
+ stdour_thread.start()
54
+ stderr_thread.start()
55
+
56
+ options = {}
57
+ oh_strategy = {}
58
+
59
+ for key in calibration_map.keys():
60
+ if "options_" in key:
61
+ options[key.replace("options_", "")] = float(calibration_map[key])
62
+ if "strategy_" in key:
63
+ oh_strategy[key.replace("strategy_", "")] = calibration_map[key]
64
+
65
+ print("\n")
66
+ print(calibration_map)
67
+ print("\n")
68
+ print(options)
69
+ print("\n")
70
+ print(oh_strategy)
71
+ print("\n")
72
+
73
+ print("Running global_best...\n")
74
+
75
+ optimizer, trace = global_best(steps, # step definition
76
+ rounds=(int(calibration_map['min_rounds']), int(calibration_map['max_rounds'])), # min/max number of rounds
77
+ args=args, # static arguments
78
+ n_particles=int(calibration_map['n_particles']), # number of particle candidates for each param
79
+ iters=int(calibration_map['iters']), # max # of iterations
80
+ n_threads=int(calibration_map['n_threads']), # number of threads to use
81
+ # ftol=0.00000001, # min cost function delta for convergence
82
+ options=options, # hyperparameter
83
+ oh_strategy=oh_strategy, # adaptive hyperparameter adjustments based on current and max # of iterations
84
+ conf={
85
+ 'service_timeout': int(calibration_map['service_timeout']),
86
+ 'http_retry': int(calibration_map['http_retry']),
87
+ 'http_allow_redirects': True if calibration_map['allow_redirects'] == "True" else False,
88
+ 'async_call': True if calibration_map['async_call'] == "True" else False,
89
+ 'http_conn_timeout': int(calibration_map['conn_timeout']),
90
+ 'http_read_timeout': int(calibration_map['read_timeout']),
91
+ 'particles_fail': int(calibration_map['particles_fail'])
92
+ },
93
+ )
94
+
95
+ stdour_thread.join()
96
+ stderr_thread.join()
97
+
98
+ sys.stdout = old_stdout
99
+ sys.stderr = old_stderr
100
+ results_queue.put((optimizer, trace))
101
+
102
+
103
+
104
+
105
+ """import csip
106
+ import cosu
107
+ import sys
108
+ import multiprocessing
109
+ import threading
110
+ import time
111
+ import os
112
+
113
+ from cosu.pso import global_best
114
+
115
+ def run_process(process_queue, data, folder):
116
+ steps = data['steps']
117
+ args = data['arguments']
118
+ calib = data['calibration_parameters']
119
+
120
+ calibration_map = {}
121
+ for param in calib:
122
+ param_name = param['name']
123
+ param_value = param['value']
124
+ calibration_map[param_name] = param_value
125
+
126
+ if not os.path.exists(folder):
127
+ os.makedirs(folder)
128
+
129
+ if (os.path.exists(os.path.join(folder, 'output.txt'))):
130
+ os.remove(os.path.join(folder, 'output.txt'))
131
+
132
+ if (os.path.exists(os.path.join(folder, 'error.txt'))):
133
+ os.remove(os.path.join(folder, 'error.txt'))
134
+
135
+ sys.stdout = open(os.path.join(folder, 'output.txt'), 'w', buffering=1)
136
+ sys.stderr = open(os.path.join(folder, 'error.txt'), 'w', buffering=1)
137
+
138
+ options = {}
139
+ oh_strategy = {}
140
+
141
+ for key in calibration_map.keys():
142
+ if "options_" in key:
143
+ options[key.replace("options_", "")] = float(calibration_map[key])
144
+ if "strategy_" in key:
145
+ oh_strategy[key.replace("strategy_", "")] = calibration_map[key]
146
+
147
+ print("\n")
148
+ print(calibration_map)
149
+ print("\n")
150
+ print(options)
151
+ print("\n")
152
+ print(oh_strategy)
153
+ print("\n")
154
+
155
+ print("Running global_best...\n")
156
+
157
+ optimizer, trace = global_best(steps, # step definition
158
+ rounds=(int(calibration_map['min_rounds']), int(calibration_map['max_rounds'])), # min/max number of rounds
159
+ args=args, # static arguments
160
+ n_particles=int(calibration_map['n_particles']), # number of particle candidates for each param
161
+ iters=int(calibration_map['iters']), # max # of iterations
162
+ n_threads=int(calibration_map['n_threads']), # number of threads to use
163
+ # ftol=0.00000001, # min cost function delta for convergence
164
+ options=options, # hyperparameter
165
+ oh_strategy=oh_strategy, # adaptive hyperparameter adjustments based on current and max # of iterations
166
+ conf={
167
+ 'service_timeout': int(calibration_map['service_timeout']),
168
+ 'http_retry': int(calibration_map['http_retry']),
169
+ 'http_allow_redirects': True if calibration_map['allow_redirects'] == "True" else False,
170
+ 'async_call': True if calibration_map['async_call'] == "True" else False,
171
+ 'http_conn_timeout': int(calibration_map['conn_timeout']),
172
+ 'http_read_timeout': int(calibration_map['read_timeout']),
173
+ 'particles_fail': int(calibration_map['particles_fail'])
174
+ },
175
+ )
176
+
177
+ process_queue.put((optimizer, trace))
178
+
179
+ """
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
  import codecs
3
3
  import os
4
4
 
5
- VERSION = '0.0.192'
5
+ VERSION = '0.0.194'
6
6
  DESCRIPTION = 'GUI for MG-PSO'
7
7
  LONG_DESCRIPTION = open('../README.md').read()
8
8
 
@@ -1,72 +0,0 @@
1
- import csip
2
- import cosu
3
- import sys
4
- import multiprocessing
5
- import threading
6
- import time
7
- import os
8
-
9
- from cosu.pso import global_best
10
-
11
- def run_process(data, folder):
12
- steps = data['steps']
13
- args = data['arguments']
14
- calib = data['calibration_parameters']
15
-
16
- calibration_map = {}
17
- for param in calib:
18
- param_name = param['name']
19
- param_value = param['value']
20
- calibration_map[param_name] = param_value
21
-
22
- if not os.path.exists(folder):
23
- os.makedirs(folder)
24
-
25
- if (os.path.exists(os.path.join(folder, 'output.txt'))):
26
- os.remove(os.path.join(folder, 'output.txt'))
27
-
28
- if (os.path.exists(os.path.join(folder, 'error.txt'))):
29
- os.remove(os.path.join(folder, 'error.txt'))
30
-
31
- sys.stdout = open(os.path.join(folder, 'output.txt'), 'w', buffering=1)
32
- sys.stderr = open(os.path.join(folder, 'error.txt'), 'w', buffering=1)
33
-
34
- options = {}
35
- oh_strategy = {}
36
-
37
- for key in calibration_map.keys():
38
- if "options_" in key:
39
- options[key.replace("options_", "")] = float(calibration_map[key])
40
- if "strategy_" in key:
41
- oh_strategy[key.replace("strategy_", "")] = calibration_map[key]
42
-
43
- print("\n")
44
- print(calibration_map)
45
- print("\n")
46
- print(options)
47
- print("\n")
48
- print(oh_strategy)
49
- print("\n")
50
-
51
- print("Running global_best...\n")
52
-
53
- optimizer, trace = global_best(steps, # step definition
54
- rounds=(int(calibration_map['min_rounds']), int(calibration_map['max_rounds'])), # min/max number of rounds
55
- args=args, # static arguments
56
- n_particles=int(calibration_map['n_particles']), # number of particle candidates for each param
57
- iters=int(calibration_map['iters']), # max # of iterations
58
- n_threads=int(calibration_map['n_threads']), # number of threads to use
59
- # ftol=0.00000001, # min cost function delta for convergence
60
- options=options, # hyperparameter
61
- oh_strategy=oh_strategy, # adaptive hyperparameter adjustments based on current and max # of iterations
62
- conf={
63
- 'service_timeout': int(calibration_map['service_timeout']),
64
- 'http_retry': int(calibration_map['http_retry']),
65
- 'http_allow_redirects': True if calibration_map['allow_redirects'] == "True" else False,
66
- 'async_call': True if calibration_map['async_call'] == "True" else False,
67
- 'http_conn_timeout': int(calibration_map['conn_timeout']),
68
- 'http_read_timeout': int(calibration_map['read_timeout']),
69
- 'particles_fail': int(calibration_map['particles_fail'])
70
- },
71
- )
72
-
File without changes