mg-pso-gui 0.1.65__py3-none-any.whl → 0.1.67__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mg-pso-gui
3
- Version: 0.1.65
3
+ Version: 0.1.67
4
4
  Summary: GUI for MG-PSO
5
5
  Author: Robert Cordingly
6
6
  Author-email: <rcording@uw.ed>
@@ -1,7 +1,7 @@
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=Kpi8YVggYAzl3iULTBTaJzVoT3Pl2z2S6JDu_TvwLTI,23480
4
+ mgpsogui/gui/HomePage.py,sha256=WSy8qai-7cj4yTnCURE3eGSIK-jhk97byGBHo9MFWaI,23619
5
5
  mgpsogui/gui/OptionManager.py,sha256=u-mXq4ouGJ-oBa71u5GffHwSXHg3Xs32P8RtSgcTmUE,12332
6
6
  mgpsogui/gui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  mgpsogui/gui/PlatformTab/PlatformTab.py,sha256=KyIoHlMKD9nfQqHeGJwRDA4RCoe4UykjB2l6xMTKK_M,10486
@@ -18,7 +18,7 @@ mgpsogui/gui/SetupTab/SetupTab.py,sha256=bqb_kgDaTi0oEOjPNBCbdyHaGvCvMRG6LAZ5DXq
18
18
  mgpsogui/gui/SetupTab/StaticParameterView.py,sha256=iEG-UpBBlAJabZo3MG768oLqOROjUPc23tKOSd47IUc,2739
19
19
  mgpsogui/gui/SetupTab/StepView.py,sha256=oG5Q-3xpTRP1f_PbNvohKctrbpD63zLAJzHD00bN44k,5531
20
20
  mgpsogui/gui/SetupTab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
- mgpsogui/gui/VisualizeTab/SideBar.py,sha256=8UU0Y-dCRdcK6wwj7J6XiLJtOvx1hXXN7HWWUVDgMmU,11276
21
+ mgpsogui/gui/VisualizeTab/SideBar.py,sha256=ZOhF6B59cOmXwwSd45Ouj_DA5Z5zhngHcto9bx8VCzw,12876
22
22
  mgpsogui/gui/VisualizeTab/VisualizeTab.py,sha256=y3ZjLR78yXjHTcHMpB637ipBKxb1CCEM3qzG8OUJvpQ,3477
23
23
  mgpsogui/gui/VisualizeTab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
24
  mgpsogui/gui/images/IGOW 4 Logo.png,sha256=JixNXz5gOEj898VF-_PHthAlGU-6W-y9ucb4EVNPtjs,433752
@@ -32,8 +32,8 @@ mgpsogui/gui/images/stop.png,sha256=JPuxXQerCGpLikcp7cAj3iLCOjULMYYZ2sZe0lArh68,
32
32
  mgpsogui/gui/images/test.png,sha256=MUnVpRK-isxhEHzx4Q6Yh0M6FRZD1qvgCHH2XmiSBbk,3642
33
33
  mgpsogui/gui/images/trash.png,sha256=j8cf0kWbJd-4Jp20lUVV1o1NSeQ4v1Ej4gfcIA3DVRQ,2958
34
34
  mgpsogui/gui/images/up.png,sha256=AQvFWCUqSQNaQ1E6LKZ9zNfSvW6t4mgy8uswdg9T2Hg,2457
35
- mgpsogui/util/GraphGenerator.py,sha256=024tgb7Yk1Hy64lUbYX0jz437ghrHmCiivKGteXcwKg,15012
36
- mgpsogui/util/PSORunner.py,sha256=wfkrZLysgSS_5BrdFEm8U-0S7DHYpxmHPau_Ec5W8ak,4510
35
+ mgpsogui/util/GraphGenerator.py,sha256=tLokgL-23QelZyf8tHPvX-Rj48E_sBp_7xCh1uEkQ_Y,14614
36
+ mgpsogui/util/PSORunner.py,sha256=4T-L4t0I6ogMeT5v7YUaURS-g_WaN0VS2sQLpgMLMs0,4502
37
37
  mgpsogui/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
38
  mgpsogui/util/CTkToolTip/__init__.py,sha256=G1jxV55hGtGgwyC1sR-uUUdasDdh0XZgcI-aILgGYA0,225
39
39
  mgpsogui/util/CTkToolTip/ctk_tooltip.py,sha256=SZMovpQIGvdpDRbqCKl9SHs92DrFCO2MOYL2ifolvOE,6329
@@ -46,8 +46,8 @@ mgpsogui/util/recosu/utils/trace_writer.py,sha256=V9BJlOjCbNYGoXGEk3CF5wjifBxvar
46
46
  mgpsogui/util/recosu/utils/utils.py,sha256=QB8vftq3142ekG0ORjz0ZBHU5YknXbR0oTsrxrPAsF0,3951
47
47
  mgpsogui/util/recosu/utils/plot/__init__.py,sha256=h1KjM7_tNDv351pcwt8A6Ibb1jhwWyx5Gbu-zj-sI3Q,71
48
48
  mgpsogui/util/recosu/utils/plot/cost_steps.py,sha256=1Ce11AJyweWkmvjXPxEygzS-h8yVLmQEDLS53yjPLqQ,3779
49
- mg_pso_gui-0.1.65.dist-info/METADATA,sha256=AQ0FTGD_82fPhV-WsOS0y1vFFSIKKrsDCCBfFo1UYOo,9458
50
- mg_pso_gui-0.1.65.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
51
- mg_pso_gui-0.1.65.dist-info/entry_points.txt,sha256=jg82VOFjR1XDGrchs1wJSCqKYE4Ozv12aBcCSp--koA,117
52
- mg_pso_gui-0.1.65.dist-info/top_level.txt,sha256=y7JuS9xJN5YdxUsQ3PSVjN8MzQAnR146bP3ZN3PYWdE,9
53
- mg_pso_gui-0.1.65.dist-info/RECORD,,
49
+ mg_pso_gui-0.1.67.dist-info/METADATA,sha256=ezUOJ4QMb9K7W3R_xE9WfJVWhPA8HklJP3wgmlHelBI,9458
50
+ mg_pso_gui-0.1.67.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
51
+ mg_pso_gui-0.1.67.dist-info/entry_points.txt,sha256=jg82VOFjR1XDGrchs1wJSCqKYE4Ozv12aBcCSp--koA,117
52
+ mg_pso_gui-0.1.67.dist-info/top_level.txt,sha256=y7JuS9xJN5YdxUsQ3PSVjN8MzQAnR146bP3ZN3PYWdE,9
53
+ mg_pso_gui-0.1.67.dist-info/RECORD,,
mgpsogui/gui/HomePage.py CHANGED
@@ -514,6 +514,14 @@ class App(customtkinter.CTk):
514
514
  print("COSU " + cosu_line, flush=True)
515
515
  except Empty:
516
516
  break
517
+
518
+ while True:
519
+ try:
520
+ trace = results_queue.get_nowait()
521
+
522
+ print("TRACE " + str(trace), flush=True)
523
+ except Empty:
524
+ break
517
525
 
518
526
  if (os.path.exists(os.path.join(folder, 'output.txt'))):
519
527
  with open(os.path.join(folder, 'output.txt'), 'r') as f:
@@ -85,15 +85,12 @@ class SideBar(CTkScrollableFrame):
85
85
 
86
86
  selected_file = self.home_page.selected_csv.get()
87
87
  if (selected_file in path_map and selected_file != self.home_page.open_file):
88
- self.home_page.csv_data = pd.read_csv(path_map[selected_file], skiprows=3)
89
- if (self.home_page.csv_data.columns[0] != "@H"):
90
- self.home_page.csv_data = pd.read_csv(path_map[selected_file], skiprows=9)
91
-
88
+ self.home_page.csv_data = self.load_csv(path_map[selected_file])
92
89
  self.home_page.open_file = selected_file
93
90
 
94
91
  if (self.home_page.csv_data is not None):
95
92
  # Get all column names of CSV
96
- columns = self.home_page.csv_data.columns
93
+ columns = self.home_page.csv_data["data"].columns
97
94
 
98
95
  x_axis_label = CTkLabel(self.containerFrame, text="X Axis:")
99
96
  x_axis_label.grid(row=2, column=0, padx=(20, 20), pady=(40, 5), sticky="w")
@@ -157,22 +154,18 @@ class SideBar(CTkScrollableFrame):
157
154
 
158
155
  selected_file = self.home_page.selected_csv.get()
159
156
  if (selected_file in path_map and selected_file != self.home_page.open_file):
160
- self.home_page.csv_data = pd.read_csv(path_map[selected_file], skiprows=3)
161
- if (self.home_page.csv_data.columns[0] != "@H"):
162
- self.home_page.csv_data = pd.read_csv(path_map[selected_file], skiprows=9)
157
+ self.home_page.csv_data = self.load_csv(path_map[selected_file])
163
158
  self.home_page.open_file = selected_file
164
159
 
165
160
  selected_file2 = self.home_page.selected_csv2.get()
166
161
  if (selected_file2 in path_map and selected_file2 != self.home_page.open_file2):
167
- self.home_page.csv_data2 = pd.read_csv(path_map[selected_file2], skiprows=3)
168
- if (self.home_page.csv_data2.columns[0] != "@H"):
169
- self.home_page.csv_data2 = pd.read_csv(path_map[selected_file2], skiprows=9)
162
+ self.home_page.csv_data2 = self.load_csv(path_map[selected_file])
170
163
  self.home_page.open_file2 = selected_file2
171
164
 
172
165
  if (self.home_page.csv_data is not None and self.home_page.csv_data2 is not None):
173
166
  # Get all column names of CSV
174
- columns = self.home_page.csv_data.columns
175
- columns2 = self.home_page.csv_data2.columns
167
+ columns = self.home_page.csv_data["data"].columns
168
+ columns2 = self.home_page.csv_data2["data"].columns
176
169
 
177
170
  x_axis_label = CTkLabel(self.containerFrame, text="X Axis:")
178
171
  x_axis_label.grid(row=3, column=0, padx=(20, 20), pady=(40, 5), sticky="w")
@@ -199,4 +192,60 @@ class SideBar(CTkScrollableFrame):
199
192
  self.home_page.csv_y2_selector.grid(row=8, column=0, padx=(20, 20), pady=(5, 5), sticky="ew")
200
193
 
201
194
  if (self.home_page.csv_y2_selector.get() not in columns2):
202
- self.home_page.csv_y2_selector.set(columns2[2])
195
+ self.home_page.csv_y2_selector.set(columns2[2])
196
+
197
+
198
+
199
+ def load_csv(file_path):
200
+ file_metadata = {}
201
+ data_metadata = {}
202
+ mode = "file_metadata"
203
+ columns = []
204
+ data_lines = []
205
+
206
+ with open(file_path, "r") as file:
207
+ lines = file.readlines()
208
+
209
+ for line in lines:
210
+ if (line.startswith("@H,")):
211
+ mode = "data_metadata"
212
+ columns = line.strip().rstrip(",").split(",")[1:]
213
+ continue
214
+ elif (line.startswith("@T,")):
215
+ mode = "file_metadata"
216
+ continue
217
+ elif (line.startswith(",") and mode == "data_metadata"):
218
+ mode = "file_data"
219
+
220
+ if (mode == "file_metadata"):
221
+ try:
222
+ key, value = line.strip().rstrip(",").split(",")
223
+ file_metadata[key] = value
224
+ except:
225
+ pass
226
+
227
+ elif (mode == "data_metadata"):
228
+ try:
229
+ values = line.strip().rstrip(",").split(",")
230
+ key = values[0]
231
+ values = values[1:]
232
+ if len(values) == len(columns):
233
+ data_metadata[key] = {}
234
+ for i in range(len(columns)):
235
+ data_metadata[key][columns[i]] = values[i]
236
+ except:
237
+ pass
238
+
239
+ elif (mode == "file_data"):
240
+ try:
241
+ values = line.strip().rstrip(",").split(",")[1:]
242
+ if len(values) == len(columns):
243
+ data_lines.append(values)
244
+ except:
245
+ pass
246
+
247
+ return {
248
+ "file_attributes": file_metadata,
249
+ "data_attributes": data_metadata,
250
+ "data": pd.DataFrame(data_lines, columns=columns)
251
+ }
@@ -283,32 +283,27 @@ def calibrated_params_by_round(config, list_of_objs, option_manager):
283
283
  def custom_csv(homepage, option_manager):
284
284
  fig = go.Figure()
285
285
 
286
- data = homepage.csv_data
286
+ data = homepage.csv_data["data"]
287
287
 
288
288
  x = homepage.csv_x_selector.get()
289
289
  val = homepage.csv_y1_selector.get()
290
290
  val2 = homepage.csv_y2_selector.get()
291
291
 
292
- data_start_index = 2
293
-
294
292
  xx = None
295
293
  if x == "time":
296
- xx = pd.to_datetime(data["time"], format='%Y-%m-%d', errors='coerce').iloc[data_start_index:]
294
+ xx = pd.to_datetime(data["time"], format='%Y-%m-%d', errors='coerce')
297
295
  elif x == "date":
298
- data_start_index = 5
299
- xx = pd.to_datetime(data["date"], format='%d-%m-%Y', errors='coerce').iloc[data_start_index:]
296
+ xx = pd.to_datetime(data["date"], format='%d-%m-%Y', errors='coerce')
300
297
  else:
301
- xx = pd.to_numeric(data[x], errors="coerce").iloc[data_start_index:]
298
+ xx = pd.to_numeric(data[x], errors="coerce")
302
299
 
303
- yy = pd.to_numeric(data[val], errors="coerce").iloc[data_start_index:]
300
+ yy = pd.to_numeric(data[val], errors="coerce")
304
301
 
305
- #yy_unit = "N/A"
306
- yy_unit = data[val].iloc[1]
302
+ yy_unit = homepage.csv_data["data_attributes"]["Unit"][val]
307
303
 
308
- yy2 = pd.to_numeric(data[val2], errors="coerce").iloc[data_start_index:]
304
+ yy2 = pd.to_numeric(data[val2], errors="coerce")
309
305
 
310
- #yy2_unit = "N/A"
311
- yy2_unit = data[val2].iloc[1]
306
+ yy2_unit = homepage.csv_data2["data_attributes"]["Unit"][val2]
312
307
 
313
308
  fig.add_trace(go.Scatter(x=xx, y=yy, name=val))
314
309
  fig.add_trace(go.Scatter(x=xx, y=yy2, name=val2, yaxis='y2'))
@@ -356,43 +351,36 @@ def custom_csv(homepage, option_manager):
356
351
  def compare_csv(homepage, option_manager):
357
352
  fig = go.Figure()
358
353
 
359
- data = homepage.csv_data
360
- data2 = homepage.csv_data2
354
+ data = homepage.csv_data["data"]
355
+ data2 = homepage.csv_data2["data"]
361
356
 
362
357
  x = homepage.csv_x_selector.get()
363
358
  val = homepage.csv_y1_selector.get()
364
359
  val2 = homepage.csv_y2_selector.get()
365
360
 
366
- data_start_index = 2
367
- data_start_index2 = 2
368
-
369
361
  xx = None
370
362
  if x == "time":
371
- xx = pd.to_datetime(data["time"], format='%Y-%m-%d', errors='coerce').iloc[data_start_index:]
363
+ xx = pd.to_datetime(data["time"], format='%Y-%m-%d', errors='coerce')
372
364
  elif x == "date":
373
- data_start_index = 5
374
- xx = pd.to_datetime(data["date"], format='%d-%m-%Y', errors='coerce').iloc[data_start_index:]
365
+ xx = pd.to_datetime(data["date"], format='%d-%m-%Y', errors='coerce')
375
366
  else:
376
- xx = pd.to_numeric(data[x], errors="coerce").iloc[data_start_index:]
367
+ xx = pd.to_numeric(data[x], errors="coerce")
377
368
 
378
- yy = pd.to_numeric(data[val], errors="coerce").iloc[data_start_index:]
369
+ yy = pd.to_numeric(data[val], errors="coerce")
379
370
 
380
371
  xx2 = None
381
372
  if x == "time":
382
- xx2 = pd.to_datetime(data2["time"], format='%Y-%m-%d', errors='coerce').iloc[data_start_index2:]
373
+ xx2 = pd.to_datetime(data2["time"], format='%Y-%m-%d', errors='coerce')
383
374
  elif x == "date":
384
375
  data_start_index2 = 5
385
- xx2 = pd.to_datetime(data2["date"], format='%d-%m-%Y', errors='coerce').iloc[data_start_index2:]
376
+ xx2 = pd.to_datetime(data2["date"], format='%d-%m-%Y', errors='coerce')
386
377
  else:
387
- xx2 = pd.to_numeric(data2[x], errors="coerce").iloc[data_start_index2:]
388
-
389
- #yy_unit = "N/A"
390
- yy_unit = data[val].iloc[1]
378
+ xx2 = pd.to_numeric(data2[x], errors="coerce")
391
379
 
392
- yy2 = pd.to_numeric(data2[val2], errors="coerce").iloc[data_start_index2:]
380
+ yy_unit = homepage.csv_data["data_attributes"]["Unit"][val]
393
381
 
394
- #yy2_unit = "N/A"
395
- yy2_unit = data2[val2].iloc[1]
382
+ yy2 = pd.to_numeric(data2[val2], errors="coerce")
383
+ yy2_unit = homepage.csv_data2["data_attributes"]["Unit"][val2]
396
384
 
397
385
  fig.add_trace(go.Scatter(x=xx, y=yy, name=val))
398
386
  fig.add_trace(go.Scatter(x=xx2, y=yy2, name=val2, yaxis='y2'))
@@ -98,8 +98,9 @@ def run_process(stdout_queue, stderr_queue, results_queue, cosu_queue, data, fol
98
98
 
99
99
  sys.stdout = old_stdout
100
100
  sys.stderr = old_stderr
101
- results_queue.put((optimizer, trace))
101
+ results_queue.put(trace)
102
102
 
103
+ """
103
104
  def get_results():
104
105
  request: Client = Client()
105
106
  for name, value in parameters.items():
@@ -138,5 +139,4 @@ def get_results():
138
139
  print(result)
139
140
  else:
140
141
  print(result)
141
-
142
-
142
+ """