mg-pso-gui 0.0.193__tar.gz → 0.0.195__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.193 → mg-pso-gui-0.0.195}/PKG-INFO +1 -1
  2. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mg_pso_gui.egg-info/PKG-INFO +1 -1
  3. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/gui/HomePage.py +17 -2
  4. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/util/GraphGenerator.py +1 -1
  5. mg-pso-gui-0.0.195/mgpsogui/util/PSORunner.py +176 -0
  6. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/setup.py +1 -1
  7. mg-pso-gui-0.0.193/mgpsogui/util/PSORunner.py +0 -74
  8. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mg_pso_gui.egg-info/SOURCES.txt +0 -0
  9. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mg_pso_gui.egg-info/dependency_links.txt +0 -0
  10. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mg_pso_gui.egg-info/entry_points.txt +0 -0
  11. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mg_pso_gui.egg-info/requires.txt +0 -0
  12. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mg_pso_gui.egg-info/top_level.txt +0 -0
  13. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/__init__.py +0 -0
  14. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/gui/OptionManager.py +0 -0
  15. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/gui/PlatformTab/PlatformTab.py +0 -0
  16. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/gui/PlatformTab/__init__.py +0 -0
  17. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/gui/RunTab/RunTab.py +0 -0
  18. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/gui/RunTab/__init__.py +0 -0
  19. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/gui/SetupTab/BoundsEditorWindow.py +0 -0
  20. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/gui/SetupTab/BoundsList.py +0 -0
  21. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/gui/SetupTab/CalibrationParametersView.py +0 -0
  22. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/gui/SetupTab/FunctionsList.py +0 -0
  23. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/gui/SetupTab/ListParametersView.py +0 -0
  24. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/gui/SetupTab/SetupTab.py +0 -0
  25. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/gui/SetupTab/StaticParameterView.py +0 -0
  26. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/gui/SetupTab/StepView.py +0 -0
  27. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/gui/SetupTab/__init__.py +0 -0
  28. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/gui/VisualizeTab/VisualizeTab.py +0 -0
  29. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/gui/VisualizeTab/__init__.py +0 -0
  30. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/gui/__init__.py +0 -0
  31. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/gui/images/collapse.png +0 -0
  32. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/gui/images/down.png +0 -0
  33. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/gui/images/expand.png +0 -0
  34. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/gui/images/play.png +0 -0
  35. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/gui/images/refresh.png +0 -0
  36. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/gui/images/refresh_hd.png +0 -0
  37. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/gui/images/stop.png +0 -0
  38. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/gui/images/trash.png +0 -0
  39. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/gui/images/up.png +0 -0
  40. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/mgpsogui.py +0 -0
  41. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/start.yaml +0 -0
  42. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/util/CTkToolTip/__init__.py +0 -0
  43. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/util/CTkToolTip/ctk_tooltip.py +0 -0
  44. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/mgpsogui/util/__init__.py +0 -0
  45. {mg-pso-gui-0.0.193 → mg-pso-gui-0.0.195}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mg-pso-gui
3
- Version: 0.0.193
3
+ Version: 0.0.195
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.193
3
+ Version: 0.0.195
4
4
  Summary: GUI for MG-PSO
5
5
  Author: Robert Cordingly
6
6
  Author-email: <rcording@uw.ed>
@@ -26,6 +26,8 @@ import ast
26
26
  import platform
27
27
  import time
28
28
 
29
+ from queue import Empty
30
+
29
31
  from ..util import PSORunner
30
32
  from ..util import GraphGenerator
31
33
 
@@ -48,6 +50,10 @@ from ..util.CTkToolTip import CTkToolTip as ctt
48
50
  customtkinter.set_appearance_mode("Dark") # Modes: "System" (standard), "Dark", "Light"
49
51
  customtkinter.set_default_color_theme("blue") # Themes: "blue" (standard), "green", "dark-blue"
50
52
 
53
+ results_queue = Queue()
54
+ stdout_queue = Queue()
55
+ stderr_queue = Queue()
56
+
51
57
  class App(customtkinter.CTk):
52
58
  def __init__(self):
53
59
  super().__init__()
@@ -341,8 +347,7 @@ class App(customtkinter.CTk):
341
347
  info = self.option_manager.get_project_data()
342
348
  folder = os.path.join(info['path'], info['name'])
343
349
 
344
- self.process_queue = Queue()
345
- self.train_process = Process(target=PSORunner.run_process, args=(self.process_queue, metrics, folder))
350
+ self.train_process = Process(target=PSORunner.run_process, args=(stdout_queue, stderr_queue, results_queue, metrics, folder))
346
351
  self.train_process.daemon = True
347
352
  self.train_process.start()
348
353
  self.after(1000, self.watch_loop)
@@ -403,6 +408,16 @@ class App(customtkinter.CTk):
403
408
 
404
409
  if not os.path.exists(folder):
405
410
  os.makedirs(folder)
411
+
412
+ try:
413
+ stdout_line = stdout_queue.get_nowait()
414
+ stderr_line = stderr_queue.get_nowait()
415
+ except Empty:
416
+ pass # No output yet
417
+ else:
418
+ # Got line from the output: do something
419
+ print(f"Received stdout: {stdout_line}")
420
+ print(f"Received stderr: {stderr_line}")
406
421
 
407
422
  if (os.path.exists(os.path.join(folder, 'output.txt'))):
408
423
  with open(os.path.join(folder, 'output.txt'), 'r') as f:
@@ -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,176 @@
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
+ old_stdout = sys.stdout
38
+ old_stderr = sys.stderr
39
+
40
+ read_stdout, write_stdout = os.pipe()
41
+ read_stderr, write_stderr = os.pipe()
42
+
43
+ sys.stdout = os.fdopen(write_stdout, 'w')
44
+ sys.stderr = os.fdopen(write_stderr, 'w')
45
+
46
+ stdour_thread = threading.Thread(target=enqueue_output, args=(os.fdopen(read_stdout, 'r'), stdout_queue))
47
+ stderr_thread = threading.Thread(target=enqueue_output, args=(os.fdopen(read_stderr, 'r'), stderr_queue))
48
+ stdour_thread.daemon = True
49
+ stderr_thread.daemon = True
50
+ stdour_thread.start()
51
+ stderr_thread.start()
52
+
53
+ options = {}
54
+ oh_strategy = {}
55
+
56
+ for key in calibration_map.keys():
57
+ if "options_" in key:
58
+ options[key.replace("options_", "")] = float(calibration_map[key])
59
+ if "strategy_" in key:
60
+ oh_strategy[key.replace("strategy_", "")] = calibration_map[key]
61
+
62
+ print("\n")
63
+ print(calibration_map)
64
+ print("\n")
65
+ print(options)
66
+ print("\n")
67
+ print(oh_strategy)
68
+ print("\n")
69
+
70
+ print("Running global_best...\n")
71
+
72
+ optimizer, trace = global_best(steps, # step definition
73
+ rounds=(int(calibration_map['min_rounds']), int(calibration_map['max_rounds'])), # min/max number of rounds
74
+ args=args, # static arguments
75
+ n_particles=int(calibration_map['n_particles']), # number of particle candidates for each param
76
+ iters=int(calibration_map['iters']), # max # of iterations
77
+ n_threads=int(calibration_map['n_threads']), # number of threads to use
78
+ # ftol=0.00000001, # min cost function delta for convergence
79
+ options=options, # hyperparameter
80
+ oh_strategy=oh_strategy, # adaptive hyperparameter adjustments based on current and max # of iterations
81
+ conf={
82
+ 'service_timeout': int(calibration_map['service_timeout']),
83
+ 'http_retry': int(calibration_map['http_retry']),
84
+ 'http_allow_redirects': True if calibration_map['allow_redirects'] == "True" else False,
85
+ 'async_call': True if calibration_map['async_call'] == "True" else False,
86
+ 'http_conn_timeout': int(calibration_map['conn_timeout']),
87
+ 'http_read_timeout': int(calibration_map['read_timeout']),
88
+ 'particles_fail': int(calibration_map['particles_fail'])
89
+ },
90
+ )
91
+
92
+ stdour_thread.join()
93
+ stderr_thread.join()
94
+
95
+ sys.stdout = old_stdout
96
+ sys.stderr = old_stderr
97
+ results_queue.put((optimizer, trace))
98
+
99
+
100
+
101
+
102
+ """import csip
103
+ import cosu
104
+ import sys
105
+ import multiprocessing
106
+ import threading
107
+ import time
108
+ import os
109
+
110
+ from cosu.pso import global_best
111
+
112
+ def run_process(process_queue, data, folder):
113
+ steps = data['steps']
114
+ args = data['arguments']
115
+ calib = data['calibration_parameters']
116
+
117
+ calibration_map = {}
118
+ for param in calib:
119
+ param_name = param['name']
120
+ param_value = param['value']
121
+ calibration_map[param_name] = param_value
122
+
123
+ if not os.path.exists(folder):
124
+ os.makedirs(folder)
125
+
126
+ if (os.path.exists(os.path.join(folder, 'output.txt'))):
127
+ os.remove(os.path.join(folder, 'output.txt'))
128
+
129
+ if (os.path.exists(os.path.join(folder, 'error.txt'))):
130
+ os.remove(os.path.join(folder, 'error.txt'))
131
+
132
+ sys.stdout = open(os.path.join(folder, 'output.txt'), 'w', buffering=1)
133
+ sys.stderr = open(os.path.join(folder, 'error.txt'), 'w', buffering=1)
134
+
135
+ options = {}
136
+ oh_strategy = {}
137
+
138
+ for key in calibration_map.keys():
139
+ if "options_" in key:
140
+ options[key.replace("options_", "")] = float(calibration_map[key])
141
+ if "strategy_" in key:
142
+ oh_strategy[key.replace("strategy_", "")] = calibration_map[key]
143
+
144
+ print("\n")
145
+ print(calibration_map)
146
+ print("\n")
147
+ print(options)
148
+ print("\n")
149
+ print(oh_strategy)
150
+ print("\n")
151
+
152
+ print("Running global_best...\n")
153
+
154
+ optimizer, trace = global_best(steps, # step definition
155
+ rounds=(int(calibration_map['min_rounds']), int(calibration_map['max_rounds'])), # min/max number of rounds
156
+ args=args, # static arguments
157
+ n_particles=int(calibration_map['n_particles']), # number of particle candidates for each param
158
+ iters=int(calibration_map['iters']), # max # of iterations
159
+ n_threads=int(calibration_map['n_threads']), # number of threads to use
160
+ # ftol=0.00000001, # min cost function delta for convergence
161
+ options=options, # hyperparameter
162
+ oh_strategy=oh_strategy, # adaptive hyperparameter adjustments based on current and max # of iterations
163
+ conf={
164
+ 'service_timeout': int(calibration_map['service_timeout']),
165
+ 'http_retry': int(calibration_map['http_retry']),
166
+ 'http_allow_redirects': True if calibration_map['allow_redirects'] == "True" else False,
167
+ 'async_call': True if calibration_map['async_call'] == "True" else False,
168
+ 'http_conn_timeout': int(calibration_map['conn_timeout']),
169
+ 'http_read_timeout': int(calibration_map['read_timeout']),
170
+ 'particles_fail': int(calibration_map['particles_fail'])
171
+ },
172
+ )
173
+
174
+ process_queue.put((optimizer, trace))
175
+
176
+ """
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
  import codecs
3
3
  import os
4
4
 
5
- VERSION = '0.0.193'
5
+ VERSION = '0.0.195'
6
6
  DESCRIPTION = 'GUI for MG-PSO'
7
7
  LONG_DESCRIPTION = open('../README.md').read()
8
8
 
@@ -1,74 +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(process_queue, 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
-
73
- process_queue.put((optimizer, trace))
74
-
File without changes