mg-pso-gui 0.1.199__py3-none-any.whl → 0.1.201__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.199.dist-info → mg_pso_gui-0.1.201.dist-info}/METADATA +1 -1
- {mg_pso_gui-0.1.199.dist-info → mg_pso_gui-0.1.201.dist-info}/RECORD +8 -8
- mgpsogui/gui/OptionManager.py +1 -1
- mgpsogui/gui/SetupTab/StepView.py +1 -1
- mgpsogui/util/PSORunner.py +107 -2
- {mg_pso_gui-0.1.199.dist-info → mg_pso_gui-0.1.201.dist-info}/WHEEL +0 -0
- {mg_pso_gui-0.1.199.dist-info → mg_pso_gui-0.1.201.dist-info}/entry_points.txt +0 -0
- {mg_pso_gui-0.1.199.dist-info → mg_pso_gui-0.1.201.dist-info}/top_level.txt +0 -0
@@ -2,7 +2,7 @@ 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
4
|
mgpsogui/gui/HomePage.py,sha256=S4vm9gtwoWjfbNmFSX5e-_l18ti0YIFulrH9a3v953s,22845
|
5
|
-
mgpsogui/gui/OptionManager.py,sha256=
|
5
|
+
mgpsogui/gui/OptionManager.py,sha256=dtWY5jzNAaL6t3q7SLHiwoKQOYrAsMGE5UqwYdmPzF4,14829
|
6
6
|
mgpsogui/gui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
7
|
mgpsogui/gui/PlatformTab/PlatformTab.py,sha256=q8x_tvVgSoyGINuQbivXRThF3gaSSfg8X_dsLSPv4F0,10492
|
8
8
|
mgpsogui/gui/PlatformTab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -17,7 +17,7 @@ mgpsogui/gui/SetupTab/ListParametersView.py,sha256=wYcDcaooYkw-y7XW6dJUwhTWxLuUU
|
|
17
17
|
mgpsogui/gui/SetupTab/OptimalParameterView.py,sha256=VKn-4BlVyqspFIOkbWsM0q9pYVsmqnSND0xP2hDKb60,1785
|
18
18
|
mgpsogui/gui/SetupTab/SetupTab.py,sha256=_cehQwQhDbX92da_AwqYQ2mQo7sFDGkN1IsYQmctK5o,2776
|
19
19
|
mgpsogui/gui/SetupTab/StaticParameterView.py,sha256=iEG-UpBBlAJabZo3MG768oLqOROjUPc23tKOSd47IUc,2739
|
20
|
-
mgpsogui/gui/SetupTab/StepView.py,sha256=
|
20
|
+
mgpsogui/gui/SetupTab/StepView.py,sha256=C6DDinU9AgaUM1EOAHetFI4bE89ANJ247F0doksaPus,9091
|
21
21
|
mgpsogui/gui/SetupTab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22
22
|
mgpsogui/gui/VisualizeTab/MatrixEditor.py,sha256=JPQmfljdddIwHtTKpFqUdk7hRzVdX-IKl4neOk3DsjM,3132
|
23
23
|
mgpsogui/gui/VisualizeTab/SideBar.py,sha256=MtZfDScNFN0fQ8DyPm6bZGJSrFRgT14fZeUq-qc61O8,21936
|
@@ -35,7 +35,7 @@ mgpsogui/gui/images/test.png,sha256=MUnVpRK-isxhEHzx4Q6Yh0M6FRZD1qvgCHH2XmiSBbk,
|
|
35
35
|
mgpsogui/gui/images/trash.png,sha256=j8cf0kWbJd-4Jp20lUVV1o1NSeQ4v1Ej4gfcIA3DVRQ,2958
|
36
36
|
mgpsogui/gui/images/up.png,sha256=AQvFWCUqSQNaQ1E6LKZ9zNfSvW6t4mgy8uswdg9T2Hg,2457
|
37
37
|
mgpsogui/util/GraphGenerator.py,sha256=OyCPwIDkbRzNZiJQII3F76yTKj_EdeMiE8vaih-n5lE,22811
|
38
|
-
mgpsogui/util/PSORunner.py,sha256=
|
38
|
+
mgpsogui/util/PSORunner.py,sha256=RbvLjnPnp0Wc-pb5jjb_5LiZH9GGNz7AGfAfrEIvyr0,10285
|
39
39
|
mgpsogui/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
40
40
|
mgpsogui/util/debug.py,sha256=Swzny9_1S-CCONWGssj9iDoSpbwu5Vr4f95g_9L8bec,19759
|
41
41
|
mgpsogui/util/helpers.py,sha256=Ht2rge_4pGO7halz6KoLsL2eukB0k2tlkx68lBBmBA8,2669
|
@@ -60,8 +60,8 @@ mgpsogui/util/recosu/utils/trace_writer.py,sha256=V9BJlOjCbNYGoXGEk3CF5wjifBxvar
|
|
60
60
|
mgpsogui/util/recosu/utils/utils.py,sha256=QB8vftq3142ekG0ORjz0ZBHU5YknXbR0oTsrxrPAsF0,3951
|
61
61
|
mgpsogui/util/recosu/utils/plot/__init__.py,sha256=h1KjM7_tNDv351pcwt8A6Ibb1jhwWyx5Gbu-zj-sI3Q,71
|
62
62
|
mgpsogui/util/recosu/utils/plot/cost_steps.py,sha256=1Ce11AJyweWkmvjXPxEygzS-h8yVLmQEDLS53yjPLqQ,3779
|
63
|
-
mg_pso_gui-0.1.
|
64
|
-
mg_pso_gui-0.1.
|
65
|
-
mg_pso_gui-0.1.
|
66
|
-
mg_pso_gui-0.1.
|
67
|
-
mg_pso_gui-0.1.
|
63
|
+
mg_pso_gui-0.1.201.dist-info/METADATA,sha256=iFwRGPO8ZsnvWBmoP1_emE62egByzLHrLp0zwty7Dvg,9456
|
64
|
+
mg_pso_gui-0.1.201.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
|
65
|
+
mg_pso_gui-0.1.201.dist-info/entry_points.txt,sha256=jg82VOFjR1XDGrchs1wJSCqKYE4Ozv12aBcCSp--koA,117
|
66
|
+
mg_pso_gui-0.1.201.dist-info/top_level.txt,sha256=y7JuS9xJN5YdxUsQ3PSVjN8MzQAnR146bP3ZN3PYWdE,9
|
67
|
+
mg_pso_gui-0.1.201.dist-info/RECORD,,
|
mgpsogui/gui/OptionManager.py
CHANGED
@@ -22,7 +22,7 @@ class OptionManager():
|
|
22
22
|
self.steps = []
|
23
23
|
self.service_parameters = {}
|
24
24
|
|
25
|
-
self.service_modes = ["Optimization: MG-PSO", "Sampling: Halton", "Sampling: Random", "Sensitivity
|
25
|
+
self.service_modes = ["Optimization: MG-PSO", "Sampling: Halton", "Sampling: Random", "Sensitivity: Halton", "Sensitivity: Random"]
|
26
26
|
for mode in self.service_modes:
|
27
27
|
self.arguments["urls"][mode] = sv()
|
28
28
|
|
@@ -106,7 +106,7 @@ class StepView(CTkScrollableFrame):
|
|
106
106
|
|
107
107
|
row += 1
|
108
108
|
|
109
|
-
if step['open'] or (self.mode == "Sampling: Halton" or self.mode == "Sampling: Random" or self.mode == "Sensitivity
|
109
|
+
if step['open'] or (self.mode == "Sampling: Halton" or self.mode == "Sampling: Random" or self.mode == "Sensitivity: Halton" or self.mode == "Sensitivity: Random"):
|
110
110
|
bounds = BoundsList.BoundsList(
|
111
111
|
self.containerFrame, option_manager=self.option_manager, step_index=index)
|
112
112
|
bounds.grid(row=row, column=0, padx=(10, 10),
|
mgpsogui/util/PSORunner.py
CHANGED
@@ -7,6 +7,10 @@ import time
|
|
7
7
|
import os
|
8
8
|
from .recosu.sampling.sampling import run_sampler
|
9
9
|
from .recosu.pso import global_best
|
10
|
+
from csip import Client
|
11
|
+
import traceback
|
12
|
+
import urllib
|
13
|
+
import shutil
|
10
14
|
|
11
15
|
def enqueue_output(out, queue):
|
12
16
|
for line in iter(out.readline, b''):
|
@@ -81,7 +85,7 @@ def run_process(stdout_queue, stderr_queue, results_queue, data, folder):
|
|
81
85
|
'read_timeout': int(calibration_map['read_timeout']),
|
82
86
|
'step_trace': os.path.join(folder, 'pso_step_trace.json')
|
83
87
|
}
|
84
|
-
|
88
|
+
elif my_mode == "Optimization: MG-PSO":
|
85
89
|
config = {
|
86
90
|
'service_timeout': int(calibration_map['service_timeout']),
|
87
91
|
'http_retry': int(calibration_map['http_retry']),
|
@@ -131,6 +135,80 @@ def run_process(stdout_queue, stderr_queue, results_queue, data, folder):
|
|
131
135
|
trace_file=os.path.join(folder, 'results', 'random_trace.csv'))
|
132
136
|
results_queue.put(trace)
|
133
137
|
print(trace, flush=True)
|
138
|
+
elif my_mode == "Sensitivity: Halton":
|
139
|
+
shutil.copyfile(os.path.join(folder, 'results', 'halton_trace.csv'), os.path.join(folder, 'results', 'trace.csv'))
|
140
|
+
trace_path = os.path.join(folder, 'results', 'trace.csv')
|
141
|
+
|
142
|
+
# Get list of parameters from steps
|
143
|
+
parameters = []
|
144
|
+
for param in steps[0]['parameters']:
|
145
|
+
parameters.append(param['name'])
|
146
|
+
|
147
|
+
request_json = {
|
148
|
+
"metainfo": {
|
149
|
+
"service_url": None,
|
150
|
+
"description": "",
|
151
|
+
"name": "",
|
152
|
+
"mode": "async"
|
153
|
+
},
|
154
|
+
"parameter": [
|
155
|
+
{
|
156
|
+
"name": "parameters",
|
157
|
+
"value": parameters
|
158
|
+
},
|
159
|
+
{
|
160
|
+
"name": "positiveBestMetrics",
|
161
|
+
"value": ["ns","kge","mns","kge09","nslog2"]
|
162
|
+
},
|
163
|
+
{
|
164
|
+
"name": "zeroBestMetrics",
|
165
|
+
"value": ["pbias","rmse"]
|
166
|
+
}
|
167
|
+
]
|
168
|
+
}
|
169
|
+
# Write the request to a file
|
170
|
+
with open(os.path.join(folder, 'results', 'request.json'), 'w') as f:
|
171
|
+
f.write(str(request_json))
|
172
|
+
request_path = os.path.join(folder, 'results', 'request.json')
|
173
|
+
|
174
|
+
sensitivity_analysis(args['url'], request_path, trace_path, folder)
|
175
|
+
elif my_mode == "Sensitivity: Random":
|
176
|
+
shutil.copyfile(os.path.join(folder, 'results', 'random_trace.csv'), os.path.join(folder, 'results', 'trace.csv'))
|
177
|
+
trace_path = os.path.join(folder, 'results', 'trace.csv')
|
178
|
+
|
179
|
+
# Get list of parameters from steps
|
180
|
+
parameters = []
|
181
|
+
for param in steps[0]['parameters']:
|
182
|
+
parameters.append(param['name'])
|
183
|
+
|
184
|
+
request_json = {
|
185
|
+
"metainfo": {
|
186
|
+
"service_url": None,
|
187
|
+
"description": "",
|
188
|
+
"name": "",
|
189
|
+
"mode": "async"
|
190
|
+
},
|
191
|
+
"parameter": [
|
192
|
+
{
|
193
|
+
"name": "parameters",
|
194
|
+
"value": parameters
|
195
|
+
},
|
196
|
+
{
|
197
|
+
"name": "positiveBestMetrics",
|
198
|
+
"value": ["ns","kge","mns","kge09","nslog2"]
|
199
|
+
},
|
200
|
+
{
|
201
|
+
"name": "zeroBestMetrics",
|
202
|
+
"value": ["pbias","rmse"]
|
203
|
+
}
|
204
|
+
]
|
205
|
+
}
|
206
|
+
# Write the request to a file
|
207
|
+
with open(os.path.join(folder, 'results', 'request.json'), 'w') as f:
|
208
|
+
f.write(str(request_json))
|
209
|
+
request_path = os.path.join(folder, 'results', 'request.json')
|
210
|
+
|
211
|
+
sensitivity_analysis(args['url'], request_path, trace_path, folder)
|
134
212
|
else:
|
135
213
|
print("Running MG-PSO Optimization...\n", flush=True)
|
136
214
|
optimizer, trace = global_best(steps,
|
@@ -166,4 +244,31 @@ def run_process(stdout_queue, stderr_queue, results_queue, data, folder):
|
|
166
244
|
stderr_thread.join()
|
167
245
|
|
168
246
|
sys.stdout = old_stdout
|
169
|
-
sys.stderr = old_stderr
|
247
|
+
sys.stderr = old_stderr
|
248
|
+
|
249
|
+
def create_request(request_file: str) -> Client:
|
250
|
+
request: Client = Client.from_file(request_file)
|
251
|
+
return request
|
252
|
+
|
253
|
+
def download_output(response: Client, target_directory) -> None:
|
254
|
+
data_names: list[str] = response.get_data_names()
|
255
|
+
for name in data_names:
|
256
|
+
url = response.get_data_value(name)
|
257
|
+
file_path = os.path.join(target_directory, name)
|
258
|
+
urllib.request.urlretrieve(url, file_path)
|
259
|
+
|
260
|
+
def sensitivity_analysis(url, request_file, trace_file, output_directory):
|
261
|
+
request: Client = create_request(request_file)
|
262
|
+
files: list[str] = [trace_file] if os.path.isfile(trace_file) else []
|
263
|
+
conf = {
|
264
|
+
'service_timeout': 60.0, # (sec)
|
265
|
+
}
|
266
|
+
result: Client = Client()
|
267
|
+
try:
|
268
|
+
result = request.execute(url, files=files, sync=True, conf=conf)
|
269
|
+
except Exception as ex:
|
270
|
+
traceback.print_exc()
|
271
|
+
exit(1)
|
272
|
+
|
273
|
+
if result.is_finished():
|
274
|
+
download_output(result, output_directory)
|
File without changes
|
File without changes
|
File without changes
|