mg-pso-gui 0.1.44__py3-none-any.whl → 0.1.46__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.44
3
+ Version: 0.1.46
4
4
  Summary: GUI for MG-PSO
5
5
  Author: Robert Cordingly
6
6
  Author-email: <rcording@uw.ed>
@@ -31,7 +31,7 @@ mgpsogui/gui/images/stop.png,sha256=JPuxXQerCGpLikcp7cAj3iLCOjULMYYZ2sZe0lArh68,
31
31
  mgpsogui/gui/images/test.png,sha256=MUnVpRK-isxhEHzx4Q6Yh0M6FRZD1qvgCHH2XmiSBbk,3642
32
32
  mgpsogui/gui/images/trash.png,sha256=j8cf0kWbJd-4Jp20lUVV1o1NSeQ4v1Ej4gfcIA3DVRQ,2958
33
33
  mgpsogui/gui/images/up.png,sha256=AQvFWCUqSQNaQ1E6LKZ9zNfSvW6t4mgy8uswdg9T2Hg,2457
34
- mgpsogui/util/GraphGenerator.py,sha256=pVEUEhg6xi7pSprWCX4kpCws26ioHh3j_8j1fjKCtqY,9683
34
+ mgpsogui/util/GraphGenerator.py,sha256=OQrEGz92xzAGdnD2qu9bs2NX1JwGkE4TElK9RaLoprw,11893
35
35
  mgpsogui/util/PSORunner.py,sha256=wfkrZLysgSS_5BrdFEm8U-0S7DHYpxmHPau_Ec5W8ak,4510
36
36
  mgpsogui/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
37
  mgpsogui/util/CTkToolTip/__init__.py,sha256=G1jxV55hGtGgwyC1sR-uUUdasDdh0XZgcI-aILgGYA0,225
@@ -45,8 +45,8 @@ mgpsogui/util/recosu/utils/trace_writer.py,sha256=V9BJlOjCbNYGoXGEk3CF5wjifBxvar
45
45
  mgpsogui/util/recosu/utils/utils.py,sha256=QB8vftq3142ekG0ORjz0ZBHU5YknXbR0oTsrxrPAsF0,3951
46
46
  mgpsogui/util/recosu/utils/plot/__init__.py,sha256=h1KjM7_tNDv351pcwt8A6Ibb1jhwWyx5Gbu-zj-sI3Q,71
47
47
  mgpsogui/util/recosu/utils/plot/cost_steps.py,sha256=1Ce11AJyweWkmvjXPxEygzS-h8yVLmQEDLS53yjPLqQ,3779
48
- mg_pso_gui-0.1.44.dist-info/METADATA,sha256=idA0QtoZ9t4DssHp8kW81n886TJLbq0nCOmqZQgrqHs,9458
49
- mg_pso_gui-0.1.44.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
50
- mg_pso_gui-0.1.44.dist-info/entry_points.txt,sha256=jg82VOFjR1XDGrchs1wJSCqKYE4Ozv12aBcCSp--koA,117
51
- mg_pso_gui-0.1.44.dist-info/top_level.txt,sha256=y7JuS9xJN5YdxUsQ3PSVjN8MzQAnR146bP3ZN3PYWdE,9
52
- mg_pso_gui-0.1.44.dist-info/RECORD,,
48
+ mg_pso_gui-0.1.46.dist-info/METADATA,sha256=yCWYgKgHDk2DLy1OBsl2j-wl2JLIUJzJQavDfblTB-k,9458
49
+ mg_pso_gui-0.1.46.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
50
+ mg_pso_gui-0.1.46.dist-info/entry_points.txt,sha256=jg82VOFjR1XDGrchs1wJSCqKYE4Ozv12aBcCSp--koA,117
51
+ mg_pso_gui-0.1.46.dist-info/top_level.txt,sha256=y7JuS9xJN5YdxUsQ3PSVjN8MzQAnR146bP3ZN3PYWdE,9
52
+ mg_pso_gui-0.1.46.dist-info/RECORD,,
@@ -26,6 +26,9 @@ def generate_graphs(HomePage):
26
26
  elif (selected_graph == "Calibrated Parameters"):
27
27
  HomePage.selected_graph_name = "calibrated_params_by_round"
28
28
  calibrated_params_by_round(HomePage.running_config['steps'], HomePage.calibration_data, HomePage.option_manager)
29
+ elif (selected_graph == "Custom CSV"):
30
+ HomePage.selected_graph_name = "custom_csv"
31
+ custom_csv(HomePage, HomePage.option_manager)
29
32
 
30
33
  image_path = os.path.join(folder, HomePage.selected_graph_name + ".png")
31
34
 
@@ -272,4 +275,70 @@ def calibrated_params_by_round(config, list_of_objs, option_manager):
272
275
  with open(os.path.join(folder, "calibrated_params_by_round.html"), "w") as f:
273
276
  f.write(html)
274
277
 
275
- return fig
278
+ return fig
279
+
280
+ def custom_csv(homepage, option_manager):
281
+ fig = go.Figure()
282
+
283
+ data = homepage.csv_data
284
+
285
+ x = homepage.csv_x_selector.get()
286
+ val = homepage.csv_y1_selector.get()
287
+ val2 = homepage.csv_y2_selector.get()
288
+
289
+ xx = None
290
+ if x == "time":
291
+ xx = pd.to_datetime(data["time"], format='%Y-%m-%d', errors='coerce').iloc[2:]
292
+ else:
293
+ xx = pd.to_numeric(data[x], errors="coerce").iloc[2:]
294
+
295
+ yy = pd.to_numeric(data[val], errors="coerce").iloc[2]
296
+
297
+ yy_unit = pd.to_numeric(data[val], errors="coerce").iloc[2]
298
+
299
+ yy2 = pd.to_numeric(data[val2], errors="coerce").iloc[2:]
300
+
301
+ yy2_unit = pd.to_numeric(data[val2], errors="coerce").iloc[2]
302
+
303
+ fig.add_trace(go.Scatter(x=xx, y=yy, name=val))
304
+ fig.add_trace(go.Scatter(x=xx, y=yy2, name=val2, yaxis='y2'))
305
+
306
+ fig.update_layout(
307
+ title="",
308
+ xaxis_title=x,
309
+ yaxis_title=val,
310
+ font=dict(color='white'),
311
+ paper_bgcolor='rgba(42, 42, 42, 0)',
312
+ plot_bgcolor='rgb(62, 62, 62)',
313
+ xaxis=dict(
314
+ gridcolor='rgb(72, 72, 72)',
315
+ gridwidth=1
316
+ ),
317
+ yaxis=dict(
318
+ title=val + " (" + str(yy_unit) + ")",
319
+ autorange=True,
320
+ gridcolor='rgb(72, 72, 72)',
321
+ gridwidth=0.1
322
+ ),
323
+ yaxis2=dict(
324
+ title=val2 + " (" + str(yy2_unit) + ")",
325
+ overlaying='y',
326
+ side='right'
327
+ )
328
+ )
329
+
330
+ info = option_manager.get_project_data()
331
+ folder = os.path.join(info['path'], info['name'])
332
+
333
+ if not os.path.exists(folder):
334
+ os.makedirs(folder)
335
+
336
+ fig.write_image(os.path.join(folder, "custom_csv.png"), width=1280, height=720)
337
+ fig.write_html(os.path.join(folder, "custom_csv.html"), include_plotlyjs='cdn', auto_open=False)
338
+ with open(os.path.join(folder, "custom_csv.html"), "r") as f:
339
+ html = f.read()
340
+ html = html.replace("<body>", "<body bgcolor='#2a2a2a'>")
341
+ with open(os.path.join(folder, "custom_csv.html"), "w") as f:
342
+ f.write(html)
343
+
344
+ return fig