mg-pso-gui 0.2.96__py3-none-any.whl → 0.2.98__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.2.96.dist-info → mg_pso_gui-0.2.98.dist-info}/METADATA +1 -1
- {mg_pso_gui-0.2.96.dist-info → mg_pso_gui-0.2.98.dist-info}/RECORD +11 -11
- mgpsogui/gui/General/ParameterView.py +43 -1
- mgpsogui/gui/HomePage.py +1 -1
- mgpsogui/gui/OptionManager.py +1 -1
- mgpsogui/gui/SetupTab/BoundsList.py +1 -1
- mgpsogui/gui/SetupTab/FunctionsList.py +5 -3
- mgpsogui/util/PSORunner.py +1 -223
- {mg_pso_gui-0.2.96.dist-info → mg_pso_gui-0.2.98.dist-info}/WHEEL +0 -0
- {mg_pso_gui-0.2.96.dist-info → mg_pso_gui-0.2.98.dist-info}/entry_points.txt +0 -0
- {mg_pso_gui-0.2.96.dist-info → mg_pso_gui-0.2.98.dist-info}/top_level.txt +0 -0
@@ -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=
|
5
|
-
mgpsogui/gui/OptionManager.py,sha256=
|
4
|
+
mgpsogui/gui/HomePage.py,sha256=qnrbwfWKuSX6z2BEuRwLMfCe88WC55dFbBbvEe5PtFI,23626
|
5
|
+
mgpsogui/gui/OptionManager.py,sha256=d-di4I9m9h0cPaKjnooTLf-QOqgIxYXbJma97EvP36I,21723
|
6
6
|
mgpsogui/gui/OptionManager_backup.py,sha256=TCWfPnHL2foN5id47jsi267lamRG6yGU6y_M29eOOJk,18530
|
7
7
|
mgpsogui/gui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
8
|
mgpsogui/gui/General/NoticeWindow.py,sha256=HcTtaYKK4b7HognnoAHXiIHZWAXI80QfR8HM2dTLTV8,1866
|
9
|
-
mgpsogui/gui/General/ParameterView.py,sha256=
|
9
|
+
mgpsogui/gui/General/ParameterView.py,sha256=to57aODZOQXC52Pjcw_dYCRcf50WKj73SkLdb3i7wps,9493
|
10
10
|
mgpsogui/gui/General/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
11
|
mgpsogui/gui/PlatformTab/PlatformTab.py,sha256=8J2Aa3Zrh1q9x07zZ0Ap9PgwHjeSKOYyj6wlxx40udw,10985
|
12
12
|
mgpsogui/gui/PlatformTab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -14,10 +14,10 @@ mgpsogui/gui/RunTab/OptimalParameterView.py,sha256=nliUEWA840cPBQt7wjiZ-L7uBOp_o
|
|
14
14
|
mgpsogui/gui/RunTab/RunTab.py,sha256=47_r8K-e7f8zs93_2iPYnNBzHDHZejtedk7iSElkubU,5608
|
15
15
|
mgpsogui/gui/RunTab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
16
|
mgpsogui/gui/SetupTab/BoundsEditorWindow.py,sha256=U64oaiDIOaimjbqKMz5rQNq2o1SrQtrRHDdTYQ9ux1s,2870
|
17
|
-
mgpsogui/gui/SetupTab/BoundsList.py,sha256=
|
17
|
+
mgpsogui/gui/SetupTab/BoundsList.py,sha256=UyXKujyZ3zOhgaLpICzLx-pm5RYsQOkwagZ75z9w9Hc,15204
|
18
18
|
mgpsogui/gui/SetupTab/CustomFunctionEditorWindow.py,sha256=yx0dHSNa7fGy99Q6qFcI6j9r8p0DlV3iOBgyPMGd8pM,2884
|
19
19
|
mgpsogui/gui/SetupTab/CustomFunctionMetrics.py,sha256=vOJpElbTgz043m6JYwe9xz_2MBHg985S6KdbJkJERW4,5923
|
20
|
-
mgpsogui/gui/SetupTab/FunctionsList.py,sha256=
|
20
|
+
mgpsogui/gui/SetupTab/FunctionsList.py,sha256=LoHu5FESu6e_QRucNVm8tuSXLl1aLoGYd9r7WOKFTaY,7059
|
21
21
|
mgpsogui/gui/SetupTab/ListEditor.py,sha256=nin7Pl8z7d_yfKoAxM-yVS34uhj-LnprJ2mNRSB7Z0A,3197
|
22
22
|
mgpsogui/gui/SetupTab/ListParametersView.py,sha256=mkGaC5cXhEOy5oD0MbTyK9z7VGZp019oK2Y8Ay-n05Q,7460
|
23
23
|
mgpsogui/gui/SetupTab/OverrideParameterMetrics.py,sha256=rBfaSitYDOajbHvyi2TfoXAHYlz1cCt028UVpIJ_Dc0,3369
|
@@ -48,7 +48,7 @@ mgpsogui/gui/images/trash.png,sha256=j8cf0kWbJd-4Jp20lUVV1o1NSeQ4v1Ej4gfcIA3DVRQ
|
|
48
48
|
mgpsogui/gui/images/up.png,sha256=AQvFWCUqSQNaQ1E6LKZ9zNfSvW6t4mgy8uswdg9T2Hg,2457
|
49
49
|
mgpsogui/gui/messages/welcome.txt,sha256=KzN_Zk3vaZeXx-G2KJmd5I7Q1_Shw62E9Fx8U4rQuUQ,5674
|
50
50
|
mgpsogui/util/GraphGenerator.py,sha256=LHHDCvBuJQ0RYQm0azi5tC-etrZ1KLQh-tkahVurPSI,31990
|
51
|
-
mgpsogui/util/PSORunner.py,sha256=
|
51
|
+
mgpsogui/util/PSORunner.py,sha256=MjK0xlKT88Pf5vk5U--xMnWJzqZGBAOR8n6AQMaYElc,15622
|
52
52
|
mgpsogui/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
53
53
|
mgpsogui/util/debug.py,sha256=Swzny9_1S-CCONWGssj9iDoSpbwu5Vr4f95g_9L8bec,19759
|
54
54
|
mgpsogui/util/helpers.py,sha256=Ht2rge_4pGO7halz6KoLsL2eukB0k2tlkx68lBBmBA8,2669
|
@@ -73,8 +73,8 @@ mgpsogui/util/recosu/utils/trace_writer.py,sha256=V9BJlOjCbNYGoXGEk3CF5wjifBxvar
|
|
73
73
|
mgpsogui/util/recosu/utils/utils.py,sha256=QB8vftq3142ekG0ORjz0ZBHU5YknXbR0oTsrxrPAsF0,3951
|
74
74
|
mgpsogui/util/recosu/utils/plot/__init__.py,sha256=h1KjM7_tNDv351pcwt8A6Ibb1jhwWyx5Gbu-zj-sI3Q,71
|
75
75
|
mgpsogui/util/recosu/utils/plot/cost_steps.py,sha256=1Ce11AJyweWkmvjXPxEygzS-h8yVLmQEDLS53yjPLqQ,3779
|
76
|
-
mg_pso_gui-0.2.
|
77
|
-
mg_pso_gui-0.2.
|
78
|
-
mg_pso_gui-0.2.
|
79
|
-
mg_pso_gui-0.2.
|
80
|
-
mg_pso_gui-0.2.
|
76
|
+
mg_pso_gui-0.2.98.dist-info/METADATA,sha256=ekBafcNKgLuq4c_qlN4Mwmx_V17NXcQOzXXS0teTJ0M,9455
|
77
|
+
mg_pso_gui-0.2.98.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
78
|
+
mg_pso_gui-0.2.98.dist-info/entry_points.txt,sha256=jg82VOFjR1XDGrchs1wJSCqKYE4Ozv12aBcCSp--koA,117
|
79
|
+
mg_pso_gui-0.2.98.dist-info/top_level.txt,sha256=y7JuS9xJN5YdxUsQ3PSVjN8MzQAnR146bP3ZN3PYWdE,9
|
80
|
+
mg_pso_gui-0.2.98.dist-info/RECORD,,
|
@@ -57,7 +57,7 @@ class ParameterView(CTkScrollableFrame):
|
|
57
57
|
CTkEntry(self.containerFrame, textvariable=self.key_values[index]["name"]).grid(row=row, column=0, columnspan=3, padx=(5, 5), pady=(5, 5), sticky="ew")
|
58
58
|
|
59
59
|
if self.edit_mode and not required:
|
60
|
-
type_menu = CTkOptionMenu(self.containerFrame, variable=self.key_values[index]["type"], values=["integer", "float", "date", "boolean", "string"], width=20)
|
60
|
+
type_menu = CTkOptionMenu(self.containerFrame, variable=self.key_values[index]["type"], values=["integer", "float", "date", "datetime", "boolean", "string"], width=20)
|
61
61
|
type_menu.grid(row=row, column=3, columnspan=1, padx=(0, 0), pady=(5, 5), sticky="ew")
|
62
62
|
|
63
63
|
dest_menu = CTkOptionMenu(self.containerFrame, variable=self.key_values[index]["destination"], values=["args", "kwargs", "conf", "options", "oh_strategy", "metainfo"], width=20)
|
@@ -73,6 +73,48 @@ class ParameterView(CTkScrollableFrame):
|
|
73
73
|
if type == "boolean":
|
74
74
|
bb = CTkOptionMenu(self.containerFrame, values=["True", "False", "NULL"], variable=self.key_values[index]["value"])
|
75
75
|
bb.grid(row=row, column=3, columnspan=3, padx=(5, 5), pady=(5, 5), sticky="ew")
|
76
|
+
elif type == "datetime":
|
77
|
+
om_text_var = self.key_values[index]["value"]
|
78
|
+
year = sv()
|
79
|
+
month = sv()
|
80
|
+
day = sv()
|
81
|
+
hour = sv()
|
82
|
+
minute = sv()
|
83
|
+
second = sv()
|
84
|
+
date_time = om_text_var.get().split(" ")
|
85
|
+
vv = date_time[0].split("-")
|
86
|
+
ss = date_time[1].split(":")
|
87
|
+
year.set(vv[0])
|
88
|
+
month.set(vv[1])
|
89
|
+
day.set(vv[2])
|
90
|
+
hour.set(ss[0])
|
91
|
+
minute.set(ss[1])
|
92
|
+
second.set(ss[2])
|
93
|
+
year_options = [str(i) for i in range(1999, 2030)]
|
94
|
+
month_options = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]
|
95
|
+
day_options = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"]
|
96
|
+
hour_options = [str(i) for i in range(0, 24)]
|
97
|
+
minute_options = [str(i) for i in range(0, 60)]
|
98
|
+
second_options = [str(i) for i in range(0, 60)]
|
99
|
+
|
100
|
+
update_date = lambda om_text_var=om_text_var, year=year, month=month, day=day: om_text_var.set(f"{year.get()}-{month.get()}-{day.get()} {hour.get()}:{minute.get()}:{second.get()}")
|
101
|
+
|
102
|
+
datetime_module = CTkFrame(self.containerFrame)
|
103
|
+
datetime_module.grid(row=row, column=3, columnspan=3, padx=(5, 5), pady=(5, 5), sticky="ew")
|
104
|
+
|
105
|
+
year_menu = CTkOptionMenu(datetime_module, variable=year, values=year_options, width=50, command=update_date)
|
106
|
+
year_menu.grid(row=0, column=0, columnspan=1, padx=(0, 0), pady=(5, 5), sticky="ew")
|
107
|
+
month_menu = CTkOptionMenu(datetime_module, variable=month, values=month_options, width=20, command=update_date)
|
108
|
+
month_menu.grid(row=0, column=1, columnspan=1, padx=(0, 0), pady=(5, 5), sticky="ew")
|
109
|
+
day_menu = CTkOptionMenu(datetime_module, variable=day, values=day_options, width=20, command=update_date)
|
110
|
+
day_menu.grid(row=0, column=2, columnspan=1, padx=(0, 0), pady=(5, 5), sticky="ew")
|
111
|
+
hour_menu = CTkOptionMenu(datetime_module, variable=hour, values=hour_options, width=20, command=update_date)
|
112
|
+
hour_menu.grid(row=1, column=0, columnspan=1, padx=(0, 0), pady=(5, 5), sticky="ew")
|
113
|
+
minute_menu = CTkOptionMenu(datetime_module, variable=minute, values=minute_options, width=20, command=update_date)
|
114
|
+
minute_menu.grid(row=1, column=1, columnspan=1, padx=(0, 0), pady=(5, 5), sticky="ew")
|
115
|
+
second_menu = CTkOptionMenu(datetime_module, variable=second, values=second_options, width=20, command=update_date)
|
116
|
+
second_menu.grid(row=1, column=2, columnspan=1, padx=(0, 0), pady=(5, 5), sticky="ew")
|
117
|
+
|
76
118
|
elif type == "date":
|
77
119
|
om_text_var = self.key_values[index]["value"]
|
78
120
|
year = sv()
|
mgpsogui/gui/HomePage.py
CHANGED
@@ -415,7 +415,7 @@ class App(customtkinter.CTk):
|
|
415
415
|
#self.progress_message_middle.configure(text="Job starting...")
|
416
416
|
self.footer_progress_label.configure(text="Starting...")
|
417
417
|
|
418
|
-
self.textbox.insert("0.0", "Starting job...\n\n")
|
418
|
+
self.textbox.insert("0.0", "Starting job of " + mode + "...\n\n")
|
419
419
|
self.textbox.insert("0.0", "Job Parameters:\n")
|
420
420
|
self.textbox.insert("0.0", json.dumps(data, indent=4) + "\n\n")
|
421
421
|
try:
|
mgpsogui/gui/OptionManager.py
CHANGED
@@ -105,7 +105,7 @@ class BoundsList(CTkFrame):
|
|
105
105
|
tt2 = None
|
106
106
|
tt3 = None
|
107
107
|
|
108
|
-
tt = CTkOptionMenu(self.containerFrame, dynamic_resizing=False, values=['float', '
|
108
|
+
tt = CTkOptionMenu(self.containerFrame, dynamic_resizing=False, values=['float', 'list', 'custom'], variable=bound["type"], command=self.refresh)
|
109
109
|
#command = lambda _, index=index, option=tt: (self.update_type(index, option))
|
110
110
|
#tt.configure(command=command)
|
111
111
|
#tt.set(bound["type"].get())
|
@@ -54,7 +54,8 @@ class FunctionsList(CTkFrame):
|
|
54
54
|
|
55
55
|
CTkLabel(self.containerFrame, text="Name:").grid(row=row, column=0, padx=(5, 5), pady=(5, 5), sticky="nsew")
|
56
56
|
CTkLabel(self.containerFrame, text="Objective:").grid(row=row, column=1, padx=(5, 5), pady=(5, 5), sticky="nsew")
|
57
|
-
|
57
|
+
if mode != "Sensitivity Analysis":
|
58
|
+
CTkLabel(self.containerFrame, text="Weight:").grid(row=row, column=2, padx=(5, 5), pady=(5, 5), sticky="nsew")
|
58
59
|
|
59
60
|
row += 1
|
60
61
|
|
@@ -81,7 +82,8 @@ class FunctionsList(CTkFrame):
|
|
81
82
|
|
82
83
|
CTkEntry(self.containerFrame, textvariable=func["name"]).grid(row=row, column=0, padx=(5, 5), pady=(5, 5), sticky="ew")
|
83
84
|
CTkOptionMenu(self.containerFrame, values=columns, variable=func["objective_function"], command=self.refresh).grid(row=row, column=1, padx=(5, 5), pady=(5, 5), sticky="ew")
|
84
|
-
|
85
|
+
if mode != "Sensitivity Analysis":
|
86
|
+
CTkEntry(self.containerFrame, textvariable=func["weight"]).grid(row=row, column=2, padx=(5, 5), pady=(5, 5), sticky="ew")
|
85
87
|
|
86
88
|
row += 1
|
87
89
|
|
@@ -107,7 +109,7 @@ class FunctionsList(CTkFrame):
|
|
107
109
|
|
108
110
|
row += 1
|
109
111
|
|
110
|
-
if mode != "
|
112
|
+
if mode != "Sensitivity Analysis":
|
111
113
|
CTkLabel(self.containerFrame, text="Observed and Simulated Data:").grid(row=row, column=0, columnspan=3, padx=(5, 5), pady=(5, 5), sticky="nsew")
|
112
114
|
|
113
115
|
row += 1
|
mgpsogui/util/PSORunner.py
CHANGED
@@ -468,226 +468,4 @@ def sensitivity_analysis(url, request_file, trace_file, output_directory):
|
|
468
468
|
exit(1)
|
469
469
|
|
470
470
|
if result.is_finished():
|
471
|
-
download_output(result, output_directory)
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
"""
|
489
|
-
def run_process_old(stdout_queue, stderr_queue, results_queue, data, folder):
|
490
|
-
steps = data['steps']
|
491
|
-
args = data['arguments']
|
492
|
-
calib = data['calibration_parameters']
|
493
|
-
|
494
|
-
my_mode = args["mode"]
|
495
|
-
|
496
|
-
# If "mode" in args remove it
|
497
|
-
if "mode" in args:
|
498
|
-
del args["mode"]
|
499
|
-
|
500
|
-
calibration_map = {}
|
501
|
-
for param in calib:
|
502
|
-
param_name = param['name']
|
503
|
-
param_value = param['value']
|
504
|
-
calibration_map[param_name] = param_value
|
505
|
-
|
506
|
-
if not os.path.exists(folder):
|
507
|
-
os.makedirs(folder)
|
508
|
-
|
509
|
-
if not os.path.exists(os.path.join(folder, "results")):
|
510
|
-
os.makedirs(os.path.join(folder, "results"))
|
511
|
-
|
512
|
-
if (os.path.exists(os.path.join(folder, 'output.txt'))):
|
513
|
-
os.remove(os.path.join(folder, 'output.txt'))
|
514
|
-
|
515
|
-
if (os.path.exists(os.path.join(folder, 'error.txt'))):
|
516
|
-
os.remove(os.path.join(folder, 'error.txt'))
|
517
|
-
|
518
|
-
old_stdout = sys.stdout
|
519
|
-
old_stderr = sys.stderr
|
520
|
-
|
521
|
-
read_stdout, write_stdout = os.pipe()
|
522
|
-
read_stderr, write_stderr = os.pipe()
|
523
|
-
|
524
|
-
sys.stdout = os.fdopen(write_stdout, 'w')
|
525
|
-
sys.stderr = os.fdopen(write_stderr, 'w')
|
526
|
-
|
527
|
-
stdout_thread = threading.Thread(target=enqueue_output, args=(os.fdopen(read_stdout, 'r'), stdout_queue))
|
528
|
-
stderr_thread = threading.Thread(target=enqueue_output, args=(os.fdopen(read_stderr, 'r'), stderr_queue))
|
529
|
-
stdout_thread.daemon = True
|
530
|
-
stderr_thread.daemon = True
|
531
|
-
stdout_thread.start()
|
532
|
-
stderr_thread.start()
|
533
|
-
|
534
|
-
try:
|
535
|
-
|
536
|
-
options = {}
|
537
|
-
oh_strategy = {}
|
538
|
-
|
539
|
-
for key in calibration_map.keys():
|
540
|
-
if "options_" in key:
|
541
|
-
options[key.replace("options_", "")] = float(calibration_map[key])
|
542
|
-
if "strategy_" in key:
|
543
|
-
oh_strategy[key.replace("strategy_", "")] = calibration_map[key]
|
544
|
-
|
545
|
-
config = {}
|
546
|
-
|
547
|
-
if my_mode == "Sampling":
|
548
|
-
config = {
|
549
|
-
'service_timeout': int(calibration_map['service_timeout']),
|
550
|
-
'http_retry': int(calibration_map['http_retry']),
|
551
|
-
'allow_redirects': True if calibration_map['allow_redirects'] == "True" else False,
|
552
|
-
'async_call': True if calibration_map['async_call'] == "True" else False,
|
553
|
-
'conn_timeout': int(calibration_map['conn_timeout']),
|
554
|
-
'read_timeout': int(calibration_map['read_timeout']),
|
555
|
-
'step_trace': os.path.join(folder, 'pso_step_trace.json')
|
556
|
-
}
|
557
|
-
elif my_mode == "Optimization":
|
558
|
-
config = {
|
559
|
-
'service_timeout': int(calibration_map['service_timeout']),
|
560
|
-
'http_retry': int(calibration_map['http_retry']),
|
561
|
-
'http_allow_redirects': True if calibration_map['allow_redirects'] == "True" else False,
|
562
|
-
'async_call': True if calibration_map['async_call'] == "True" else False,
|
563
|
-
'http_conn_timeout': int(calibration_map['conn_timeout']),
|
564
|
-
'http_read_timeout': int(calibration_map['read_timeout']),
|
565
|
-
'particles_fail': int(calibration_map['particles_fail']),
|
566
|
-
'step_trace': os.path.join(folder, 'pso_step_trace.json')
|
567
|
-
}
|
568
|
-
|
569
|
-
print("\n")
|
570
|
-
print(steps)
|
571
|
-
print("\n")
|
572
|
-
print(args)
|
573
|
-
print("\n")
|
574
|
-
print(calibration_map)
|
575
|
-
print("\n")
|
576
|
-
print(options)
|
577
|
-
print("\n")
|
578
|
-
print(oh_strategy)
|
579
|
-
print("\n")
|
580
|
-
print(config)
|
581
|
-
print("\n", flush=True)
|
582
|
-
|
583
|
-
if my_mode == "Sampling: Halton":
|
584
|
-
print("Running Halton Sampling..\n", flush=True)
|
585
|
-
trace = run_sampler(steps,
|
586
|
-
args,
|
587
|
-
int(calibration_map['count']),
|
588
|
-
int(calibration_map['num_threads']),
|
589
|
-
"halton",
|
590
|
-
conf=config,
|
591
|
-
trace_file=os.path.join(folder, 'results', 'halton_trace.csv'),
|
592
|
-
offset=int(calibration_map['offset']))
|
593
|
-
results_queue.put(trace)
|
594
|
-
print(trace, flush=True)
|
595
|
-
print("\n", flush=True)
|
596
|
-
|
597
|
-
elif my_mode == "Sampling: Random":
|
598
|
-
print("Running Random Sampling...\n", flush=True)
|
599
|
-
trace = run_sampler(steps,
|
600
|
-
args,
|
601
|
-
int(calibration_map['count']),
|
602
|
-
int(calibration_map['num_threads']),
|
603
|
-
"random",
|
604
|
-
conf=config,
|
605
|
-
trace_file=os.path.join(folder, 'results', 'random_trace.csv'))
|
606
|
-
results_queue.put(trace)
|
607
|
-
print(trace, flush=True)
|
608
|
-
print("\n", flush=True)
|
609
|
-
|
610
|
-
elif my_mode == "Sensitivity Analysis":
|
611
|
-
|
612
|
-
print("Running Sensitivity Analysis", flush=True)
|
613
|
-
|
614
|
-
shutil.copyfile(data["sensitivity_analysis_path"], os.path.join(folder, 'results', 'trace.csv'))
|
615
|
-
trace_path = os.path.join(folder, 'results', 'trace.csv')
|
616
|
-
|
617
|
-
# Get list of parameters from steps
|
618
|
-
parameters = []
|
619
|
-
for param in steps[0]['param']:
|
620
|
-
parameters.append(param['name'])
|
621
|
-
|
622
|
-
request_json = {
|
623
|
-
"metainfo": {
|
624
|
-
"service_url": None,
|
625
|
-
"description": "",
|
626
|
-
"name": "",
|
627
|
-
"mode": "async"
|
628
|
-
},
|
629
|
-
"parameter": [
|
630
|
-
{
|
631
|
-
"name": "parameters",
|
632
|
-
"value": parameters
|
633
|
-
},
|
634
|
-
{
|
635
|
-
"name": "positiveBestMetrics",
|
636
|
-
"value": ["ns","kge","mns","kge09","nslog2"]
|
637
|
-
},
|
638
|
-
{
|
639
|
-
"name": "zeroBestMetrics",
|
640
|
-
"value": ["pbias","rmse"]
|
641
|
-
}
|
642
|
-
]
|
643
|
-
}
|
644
|
-
|
645
|
-
with open(os.path.join(folder, 'results', 'request.json'), 'w') as json_file:
|
646
|
-
json.dump(request_json, json_file, indent=4)
|
647
|
-
|
648
|
-
request_path = os.path.join(folder, 'results', 'request.json')
|
649
|
-
|
650
|
-
output_directory = os.path.join(folder, 'results')
|
651
|
-
|
652
|
-
print("Starting ", args['url'], request_path, trace_path, output_directory, flush=True)
|
653
|
-
|
654
|
-
sensitivity_analysis(args['url'], request_path, trace_path, output_directory)
|
655
|
-
|
656
|
-
print("Finished Sensitivity Analysis", flush=True)
|
657
|
-
else:
|
658
|
-
print("Running MG-PSO Optimization...\n", flush=True)
|
659
|
-
optimizer, trace = global_best(steps,
|
660
|
-
rounds=(int(calibration_map['min_rounds']), int(calibration_map['max_rounds'])),
|
661
|
-
args=args,
|
662
|
-
n_particles=int(calibration_map['n_particles']),
|
663
|
-
iters=int(calibration_map['iters']),
|
664
|
-
n_threads=int(calibration_map['n_threads']),
|
665
|
-
options=options,
|
666
|
-
oh_strategy=oh_strategy,
|
667
|
-
conf=config
|
668
|
-
)
|
669
|
-
|
670
|
-
results_queue.put(trace)
|
671
|
-
print(trace, flush=True)
|
672
|
-
|
673
|
-
print("Finishing up...", flush=True)
|
674
|
-
time.sleep(5)
|
675
|
-
except Exception as e:
|
676
|
-
print("An exception occurred: ", flush=True)
|
677
|
-
print(str(e))
|
678
|
-
# Print stack trace
|
679
|
-
import traceback
|
680
|
-
traceback.print_exc()
|
681
|
-
|
682
|
-
# Write all of this information to a crash file
|
683
|
-
with open(os.path.join(folder, 'crash.txt'), 'w') as f:
|
684
|
-
f.write(str(e))
|
685
|
-
f.write("\n")
|
686
|
-
traceback.print_exc(file=f)
|
687
|
-
finally:
|
688
|
-
stdout_thread.join()
|
689
|
-
stderr_thread.join()
|
690
|
-
|
691
|
-
sys.stdout = old_stdout
|
692
|
-
sys.stderr = old_stderr
|
693
|
-
"""
|
471
|
+
download_output(result, output_directory)
|
File without changes
|
File without changes
|
File without changes
|