mg-pso-gui 0.2.62__py3-none-any.whl → 0.2.64__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.62.dist-info → mg_pso_gui-0.2.64.dist-info}/METADATA +1 -1
- {mg_pso_gui-0.2.62.dist-info → mg_pso_gui-0.2.64.dist-info}/RECORD +8 -8
- mgpsogui/gui/SetupTab/BoundsList.py +44 -23
- mgpsogui/gui/SetupTab/StepView.py +2 -1
- mgpsogui/util/PSORunner.py +31 -2
- {mg_pso_gui-0.2.62.dist-info → mg_pso_gui-0.2.64.dist-info}/WHEEL +0 -0
- {mg_pso_gui-0.2.62.dist-info → mg_pso_gui-0.2.64.dist-info}/entry_points.txt +0 -0
- {mg_pso_gui-0.2.62.dist-info → mg_pso_gui-0.2.64.dist-info}/top_level.txt +0 -0
@@ -13,7 +13,7 @@ mgpsogui/gui/RunTab/OptimalParameterView.py,sha256=nliUEWA840cPBQt7wjiZ-L7uBOp_o
|
|
13
13
|
mgpsogui/gui/RunTab/RunTab.py,sha256=47_r8K-e7f8zs93_2iPYnNBzHDHZejtedk7iSElkubU,5608
|
14
14
|
mgpsogui/gui/RunTab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
15
15
|
mgpsogui/gui/SetupTab/BoundsEditorWindow.py,sha256=U64oaiDIOaimjbqKMz5rQNq2o1SrQtrRHDdTYQ9ux1s,2870
|
16
|
-
mgpsogui/gui/SetupTab/BoundsList.py,sha256=
|
16
|
+
mgpsogui/gui/SetupTab/BoundsList.py,sha256=D-wvphmYznjvdTotXtjIBi2tlvvghMJH6oCsLk20pH8,13900
|
17
17
|
mgpsogui/gui/SetupTab/CustomFunctionEditorWindow.py,sha256=yx0dHSNa7fGy99Q6qFcI6j9r8p0DlV3iOBgyPMGd8pM,2884
|
18
18
|
mgpsogui/gui/SetupTab/CustomFunctionMetrics.py,sha256=vOJpElbTgz043m6JYwe9xz_2MBHg985S6KdbJkJERW4,5923
|
19
19
|
mgpsogui/gui/SetupTab/FunctionsList.py,sha256=ntbIUs8q2Tm3KfBLleT7uL0gynwYuVycwvXv8vude3c,6611
|
@@ -22,7 +22,7 @@ mgpsogui/gui/SetupTab/ListParametersView.py,sha256=mkGaC5cXhEOy5oD0MbTyK9z7VGZp0
|
|
22
22
|
mgpsogui/gui/SetupTab/OverrideParameterMetrics.py,sha256=rBfaSitYDOajbHvyi2TfoXAHYlz1cCt028UVpIJ_Dc0,3369
|
23
23
|
mgpsogui/gui/SetupTab/OverrideParameterWindow.py,sha256=UpZDxTaFxee0BeviUYXeiIlMNYNy00qz3zlMlM5VcXE,1291
|
24
24
|
mgpsogui/gui/SetupTab/SetupTab.py,sha256=3V8LYvg5ulTll1hhguB_XpSoOR-w72vHh_Z3gw3nCxc,2758
|
25
|
-
mgpsogui/gui/SetupTab/StepView.py,sha256=
|
25
|
+
mgpsogui/gui/SetupTab/StepView.py,sha256=SfkEu8rOTtuqxPTOt19ECjSwgUA2h5S18HAJKCbjPjg,9011
|
26
26
|
mgpsogui/gui/SetupTab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
27
27
|
mgpsogui/gui/VisualizeTab/MatrixEditor.py,sha256=Gzyl2hRgjIfO5n0bCZZoXp_vOFvfsJPaGXDUMeRQg10,3171
|
28
28
|
mgpsogui/gui/VisualizeTab/SideBar.py,sha256=wPjzA8ZZsCTxBKN0_6-_ABtU5BeHqytNAWfKCWAPoe8,22106
|
@@ -44,7 +44,7 @@ mgpsogui/gui/images/test.png,sha256=MUnVpRK-isxhEHzx4Q6Yh0M6FRZD1qvgCHH2XmiSBbk,
|
|
44
44
|
mgpsogui/gui/images/trash.png,sha256=j8cf0kWbJd-4Jp20lUVV1o1NSeQ4v1Ej4gfcIA3DVRQ,2958
|
45
45
|
mgpsogui/gui/images/up.png,sha256=AQvFWCUqSQNaQ1E6LKZ9zNfSvW6t4mgy8uswdg9T2Hg,2457
|
46
46
|
mgpsogui/util/GraphGenerator.py,sha256=dKzDPMK-0S6j1yIp5xoQIgN9GTKMhGpboAXjofCpmIk,31973
|
47
|
-
mgpsogui/util/PSORunner.py,sha256=
|
47
|
+
mgpsogui/util/PSORunner.py,sha256=tTe2sF9MRk48dpsNwSn_CbSSNq1laXWMxSZFh_v5FIQ,23115
|
48
48
|
mgpsogui/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
49
49
|
mgpsogui/util/debug.py,sha256=Swzny9_1S-CCONWGssj9iDoSpbwu5Vr4f95g_9L8bec,19759
|
50
50
|
mgpsogui/util/helpers.py,sha256=Ht2rge_4pGO7halz6KoLsL2eukB0k2tlkx68lBBmBA8,2669
|
@@ -69,8 +69,8 @@ mgpsogui/util/recosu/utils/trace_writer.py,sha256=V9BJlOjCbNYGoXGEk3CF5wjifBxvar
|
|
69
69
|
mgpsogui/util/recosu/utils/utils.py,sha256=QB8vftq3142ekG0ORjz0ZBHU5YknXbR0oTsrxrPAsF0,3951
|
70
70
|
mgpsogui/util/recosu/utils/plot/__init__.py,sha256=h1KjM7_tNDv351pcwt8A6Ibb1jhwWyx5Gbu-zj-sI3Q,71
|
71
71
|
mgpsogui/util/recosu/utils/plot/cost_steps.py,sha256=1Ce11AJyweWkmvjXPxEygzS-h8yVLmQEDLS53yjPLqQ,3779
|
72
|
-
mg_pso_gui-0.2.
|
73
|
-
mg_pso_gui-0.2.
|
74
|
-
mg_pso_gui-0.2.
|
75
|
-
mg_pso_gui-0.2.
|
76
|
-
mg_pso_gui-0.2.
|
72
|
+
mg_pso_gui-0.2.64.dist-info/METADATA,sha256=gxlo1HwwHekjaSxRYDCxFgI_kTvIpAoW4VfudqfOryY,9455
|
73
|
+
mg_pso_gui-0.2.64.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
74
|
+
mg_pso_gui-0.2.64.dist-info/entry_points.txt,sha256=jg82VOFjR1XDGrchs1wJSCqKYE4Ozv12aBcCSp--koA,117
|
75
|
+
mg_pso_gui-0.2.64.dist-info/top_level.txt,sha256=y7JuS9xJN5YdxUsQ3PSVjN8MzQAnR146bP3ZN3PYWdE,9
|
76
|
+
mg_pso_gui-0.2.64.dist-info/RECORD,,
|
@@ -13,6 +13,7 @@ import json
|
|
13
13
|
import PIL
|
14
14
|
from PIL import Image
|
15
15
|
import os
|
16
|
+
import pandas as pd
|
16
17
|
|
17
18
|
class BoundsList(CTkFrame):
|
18
19
|
def __init__(self, *args,
|
@@ -21,20 +22,8 @@ class BoundsList(CTkFrame):
|
|
21
22
|
**kwargs):
|
22
23
|
super().__init__(*args, **kwargs)
|
23
24
|
|
24
|
-
self.optParams = []
|
25
25
|
self.option_manager = option_manager
|
26
26
|
|
27
|
-
details = self.option_manager.serialize_data(self.option_manager.get("service_request_data"))
|
28
|
-
self.paramMap = {}
|
29
|
-
if "parameter" in details:
|
30
|
-
for param in details["parameter"]:
|
31
|
-
self.paramMap[param["name"]] = param
|
32
|
-
if "min" in param:
|
33
|
-
self.optParams.append(param["name"])
|
34
|
-
|
35
|
-
self.optParams.sort()
|
36
|
-
|
37
|
-
|
38
27
|
self.edit_mode = False
|
39
28
|
self.tooltip_list = []
|
40
29
|
|
@@ -64,6 +53,30 @@ class BoundsList(CTkFrame):
|
|
64
53
|
self.tooltip_list = []
|
65
54
|
|
66
55
|
mode = self.option_manager.get_mode()
|
56
|
+
|
57
|
+
# Load bound parameters depending on the mode
|
58
|
+
self.optParams = []
|
59
|
+
if mode == "Optimization" or mode == "Sampling: Halton" or mode == "Sampling: Random":
|
60
|
+
details = self.option_manager.serialize_data(self.option_manager.get("service_request_data"))
|
61
|
+
self.paramMap = {}
|
62
|
+
if "parameter" in details:
|
63
|
+
for param in details["parameter"]:
|
64
|
+
self.paramMap[param["name"]] = param
|
65
|
+
if "min" in param:
|
66
|
+
self.optParams.append(param["name"])
|
67
|
+
|
68
|
+
self.optParams.sort()
|
69
|
+
elif mode == "Sensitivity Analysis":
|
70
|
+
file_path = self.option_manager.get("sensitivity_analysis_path").get()
|
71
|
+
if os.path.exists(file_path):
|
72
|
+
try:
|
73
|
+
df = pd.read_csv(file_path)
|
74
|
+
self.optParams = df.columns.tolist()
|
75
|
+
except Exception as e:
|
76
|
+
print(f"Error loading CSV file: {e}")
|
77
|
+
else:
|
78
|
+
print(f"File does not exist: {file_path}")
|
79
|
+
|
67
80
|
|
68
81
|
self.containerFrame = CTkFrame(self, fg_color="transparent")
|
69
82
|
self.containerFrame.grid(row=0, column=0, padx=(5, 5), pady=(5, 5), sticky="nsew")
|
@@ -137,26 +150,34 @@ class BoundsList(CTkFrame):
|
|
137
150
|
self.validate_number(bounds_max.get(), cc, bounds_max)
|
138
151
|
tt2 = ctt(bounds_max, delay=0.1, alpha=0.95, message="...")
|
139
152
|
|
140
|
-
if mode == "Sampling: Random" or mode == "Sampling: Halton":
|
141
|
-
row += 1
|
142
|
-
index += 1
|
143
|
-
continue
|
144
|
-
|
145
|
-
default_value = CTkEntry(self.containerFrame)
|
146
|
-
default_value.grid(row=row, column=4, padx=(5, 5), pady=(5, 5), sticky="new")
|
147
|
-
default_value.configure(textvariable=bound["default_value"])
|
148
|
-
|
149
|
-
|
150
153
|
if (bound_type == "list"):
|
151
154
|
def button_click_event(bound_index):
|
152
155
|
BEW(title="Edit List Bound", step_index=self.step_index, bound_index=bound_index, option_manager=self.option_manager)
|
153
|
-
#print("Number:", dialog.get_input())
|
154
156
|
|
155
157
|
open_window = lambda event=None, bound_index=index: (button_click_event(bound_index))
|
156
158
|
expand_image = CTkImage(Image.open(os.path.join("./images", "expand.png")), size=(20, 20))
|
157
159
|
button = CTkButton(self.containerFrame, width=30, text=None, image=expand_image, command=open_window)
|
158
160
|
button.grid(row=row, column=6, padx=(5, 5), pady=(5, 5), sticky="new")
|
159
161
|
|
162
|
+
if mode == "Sampling: Random" or mode == "Sampling: Halton":
|
163
|
+
|
164
|
+
tt1 = ctt(bounds_min, delay=0.1, alpha=0.95, message="...")
|
165
|
+
tt2 = ctt(bounds_max, delay=0.1, alpha=0.95, message="...")
|
166
|
+
if cc is not None:
|
167
|
+
tt3 = ctt(cc, delay=0.1, alpha=0.95, message="...")
|
168
|
+
|
169
|
+
self.tooltip_list.append([tt3, tt1, tt2])
|
170
|
+
|
171
|
+
self.update_tooltips(index)
|
172
|
+
|
173
|
+
row += 1
|
174
|
+
index += 1
|
175
|
+
continue
|
176
|
+
|
177
|
+
default_value = CTkEntry(self.containerFrame)
|
178
|
+
default_value.grid(row=row, column=4, padx=(5, 5), pady=(5, 5), sticky="new")
|
179
|
+
default_value.configure(textvariable=bound["default_value"])
|
180
|
+
|
160
181
|
calibration_strat = CTkOptionMenu(self.containerFrame, dynamic_resizing=False, values=['none', 'mean', 'single'], variable=bound["calibration_strategy"])
|
161
182
|
calibration_strat.grid(row=row, column=5, padx=(5, 5), pady=(5, 5), sticky="new")
|
162
183
|
|
@@ -85,6 +85,7 @@ class StepView(CTkScrollableFrame):
|
|
85
85
|
|
86
86
|
if (self.mode == "Sensitivity Analysis"):
|
87
87
|
folder = self.option_manager.get_project_folder()
|
88
|
+
folder = os.path.join(folder, "results")
|
88
89
|
|
89
90
|
# File all CSV files in folder and put them into list with strings as path
|
90
91
|
files = []
|
@@ -104,7 +105,7 @@ class StepView(CTkScrollableFrame):
|
|
104
105
|
self.logo_label = CTkLabel(self.file_selector_frame, text="Select File:")
|
105
106
|
self.logo_label.grid(row=0, column=0, padx=(10, 10), pady=header_padding_y)
|
106
107
|
|
107
|
-
self.file_selector = CTkOptionMenu(self.file_selector_frame, values=files, width=50, variable=self.option_manager.get("sensitivity_analysis_path"))
|
108
|
+
self.file_selector = CTkOptionMenu(self.file_selector_frame, values=files, width=50, variable=self.option_manager.get("sensitivity_analysis_path"), command=self.refresh)
|
108
109
|
self.file_selector.grid(row=0, column=1, padx=(10, 10), pady=header_padding_y)
|
109
110
|
|
110
111
|
row += 1
|
mgpsogui/util/PSORunner.py
CHANGED
@@ -230,7 +230,14 @@ def run_sampling(data, mode, folder, results_queue):
|
|
230
230
|
|
231
231
|
output_steps = process_steps(data)
|
232
232
|
|
233
|
-
|
233
|
+
trace_file = os.path.join(folder, 'results', mode + '_trace.csv')
|
234
|
+
file_output_mode = data["sampling_output_mode"]
|
235
|
+
if file_output_mode == "Append":
|
236
|
+
# Backup trace file if it exists
|
237
|
+
if os.path.exists(trace_file):
|
238
|
+
shutil.copyfile(trace_file, trace_file + ".bak")
|
239
|
+
|
240
|
+
#config['step_trace'] = os.path.join(folder, 'pso_step_trace.json') # Do we need this?
|
234
241
|
|
235
242
|
print("Parsing Parameters...\n", flush=True)
|
236
243
|
print("steps: ", flush=True)
|
@@ -256,12 +263,34 @@ def run_sampling(data, mode, folder, results_queue):
|
|
256
263
|
mode,
|
257
264
|
conf=config,
|
258
265
|
metainfo=metainfo if len(metainfo) > 0 else None,
|
259
|
-
trace_file=
|
266
|
+
trace_file=trace_file,
|
260
267
|
offset=int(pp('offset', parameter_map)))
|
261
268
|
results_queue.put(trace)
|
262
269
|
print(trace, flush=True)
|
263
270
|
print("\n", flush=True)
|
264
271
|
|
272
|
+
if file_output_mode == "Append" and os.path.exists(trace_file + ".bak"):
|
273
|
+
# Read the backup file
|
274
|
+
with open(trace_file + ".bak", 'r') as f2:
|
275
|
+
backup_lines = f2.readlines()
|
276
|
+
|
277
|
+
# Read the trace file
|
278
|
+
with open(trace_file, 'r') as f:
|
279
|
+
trace_lines = f.readlines()
|
280
|
+
|
281
|
+
# Extract headers
|
282
|
+
backup_header = backup_lines[0]
|
283
|
+
trace_header = trace_lines[0]
|
284
|
+
|
285
|
+
# Combine data ensuring headers are not duplicated
|
286
|
+
with open(trace_file, 'w') as f:
|
287
|
+
f.write(backup_header)
|
288
|
+
f.writelines(backup_lines[1:])
|
289
|
+
f.writelines(trace_lines[1:] if trace_header == backup_header else trace_lines)
|
290
|
+
|
291
|
+
# Remove the backup file
|
292
|
+
os.remove(trace_file + ".bak")
|
293
|
+
|
265
294
|
def run_optimization(data, folder, results_queue):
|
266
295
|
"""_summary_
|
267
296
|
|
File without changes
|
File without changes
|
File without changes
|