mg-pso-gui 0.2.125__py3-none-any.whl → 0.2.127__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.2.125
3
+ Version: 0.2.127
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=N_0FGZ8R6fiMBHiNWYNMM8h3QvudteaJ_Fq5GDxoPug,26053
4
+ mgpsogui/gui/HomePage.py,sha256=fTGAuCUBWaydSe0t7HO95snJ1B6j2xa5GJcEJSLymBA,25974
5
5
  mgpsogui/gui/OptionManager.py,sha256=t0aXOeBo48qQ-P8OykpP2v_3KJoaJtUPSkYtacjloCc,22844
6
6
  mgpsogui/gui/OptionManager_backup.py,sha256=TCWfPnHL2foN5id47jsi267lamRG6yGU6y_M29eOOJk,18530
7
7
  mgpsogui/gui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -19,7 +19,7 @@ mgpsogui/gui/SetupTab/CustomFunctionEditorWindow.py,sha256=lZ9a20YucwhCDiUN3eGA6
19
19
  mgpsogui/gui/SetupTab/CustomFunctionMetrics.py,sha256=vOJpElbTgz043m6JYwe9xz_2MBHg985S6KdbJkJERW4,5923
20
20
  mgpsogui/gui/SetupTab/FunctionsList.py,sha256=wmYmppyB5y8QADe3X_FQ5mAYVDC0HAPQgqtkegNwmLA,7007
21
21
  mgpsogui/gui/SetupTab/ListEditor.py,sha256=nin7Pl8z7d_yfKoAxM-yVS34uhj-LnprJ2mNRSB7Z0A,3197
22
- mgpsogui/gui/SetupTab/ListParametersView.py,sha256=mkGaC5cXhEOy5oD0MbTyK9z7VGZp019oK2Y8Ay-n05Q,7460
22
+ mgpsogui/gui/SetupTab/ListParametersView.py,sha256=CdK7OVdccwk0_OLgrwwNFTHuV2hMvETsocQIKndZoV4,7459
23
23
  mgpsogui/gui/SetupTab/OverrideParameterMetrics.py,sha256=rBfaSitYDOajbHvyi2TfoXAHYlz1cCt028UVpIJ_Dc0,3369
24
24
  mgpsogui/gui/SetupTab/OverrideParameterWindow.py,sha256=1UJHel0BH4sYa5WQnuSaFd3cdpRwAIwOpFIbhDS30IY,1824
25
25
  mgpsogui/gui/SetupTab/SamplingListView.py,sha256=DhZBAhDcrqZn1XioCs1gTe_v-8W10C0UfPm0fLAbeXM,5260
@@ -57,8 +57,11 @@ mgpsogui/util/CTkToolTip/__init__.py,sha256=G1jxV55hGtGgwyC1sR-uUUdasDdh0XZgcI-a
57
57
  mgpsogui/util/CTkToolTip/ctk_tooltip.py,sha256=SZMovpQIGvdpDRbqCKl9SHs92DrFCO2MOYL2ifolvOE,6329
58
58
  mgpsogui/util/recosu/__init__.py,sha256=pPR0lB6clIi6q73H1W8eT5u0dd3bIemwa9-XFmOaVVk,279
59
59
  mgpsogui/util/recosu/pso/__init__.py,sha256=PQ548aEKVOk6MMzxxDg7yMO_1hHfoEoYLLkGLeij73Y,247
60
- mgpsogui/util/recosu/pso/csip_access.py,sha256=_oA71d6CSwhKSa3pgywIW7mXRJtgJTNu1X2DiBkQkuA,4152
61
- mgpsogui/util/recosu/pso/pso.py,sha256=qUwpp6gjhCTXA6twKGAda84HIeQebKGB6MJ4K9GfcdM,23181
60
+ mgpsogui/util/recosu/pso/csip_access.py,sha256=jBli1MSShUUwQCMKOUvMaGuNwBViCrjXJi_FmSEJsZA,2721
61
+ mgpsogui/util/recosu/pso/csip_access_new.py,sha256=_oA71d6CSwhKSa3pgywIW7mXRJtgJTNu1X2DiBkQkuA,4152
62
+ mgpsogui/util/recosu/pso/pso modified.py,sha256=sFY1csASu5Os5SSheWWdpVcjpPwJeBqZKsv89DLXdxk,21648
63
+ mgpsogui/util/recosu/pso/pso.py,sha256=iPqT6aI1vi8LYuWmtxuHkLEM9sQwhUznPInBgps7ANI,13708
64
+ mgpsogui/util/recosu/pso/pso_new.py,sha256=qUwpp6gjhCTXA6twKGAda84HIeQebKGB6MJ4K9GfcdM,23181
62
65
  mgpsogui/util/recosu/sampling/__init__.py,sha256=dWs1MPx0o2UFmOmUfFaomQWBTIZAwALsVJzZQNZePZU,252
63
66
  mgpsogui/util/recosu/sampling/sample_trace_writer.py,sha256=M9w-POLlZgjL5a7J7yxr73OG6mCsS2aUuP9d3HKfkbA,1966
64
67
  mgpsogui/util/recosu/sampling/sampler_task.py,sha256=uZobpR83u6xEaUzIknvW9FbB84c2AL7T-5T8O8QIhzY,2776
@@ -73,8 +76,8 @@ mgpsogui/util/recosu/utils/trace_writer.py,sha256=V9BJlOjCbNYGoXGEk3CF5wjifBxvar
73
76
  mgpsogui/util/recosu/utils/utils.py,sha256=6MIoJb0nhIa4tNv7qhBfZi-AtL3L95CgJf6eAf12NQs,4140
74
77
  mgpsogui/util/recosu/utils/plot/__init__.py,sha256=h1KjM7_tNDv351pcwt8A6Ibb1jhwWyx5Gbu-zj-sI3Q,71
75
78
  mgpsogui/util/recosu/utils/plot/cost_steps.py,sha256=1Ce11AJyweWkmvjXPxEygzS-h8yVLmQEDLS53yjPLqQ,3779
76
- mg_pso_gui-0.2.125.dist-info/METADATA,sha256=1cfBNFu2xvNbvbzQQKz2JtmCFVC5Z49qKHPxNW0oWB4,9542
77
- mg_pso_gui-0.2.125.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
78
- mg_pso_gui-0.2.125.dist-info/entry_points.txt,sha256=jg82VOFjR1XDGrchs1wJSCqKYE4Ozv12aBcCSp--koA,117
79
- mg_pso_gui-0.2.125.dist-info/top_level.txt,sha256=y7JuS9xJN5YdxUsQ3PSVjN8MzQAnR146bP3ZN3PYWdE,9
80
- mg_pso_gui-0.2.125.dist-info/RECORD,,
79
+ mg_pso_gui-0.2.127.dist-info/METADATA,sha256=CKrIBp-9Wkp8fyOPmG0KADmYCL5jRNH3OBKdhit0Rl8,9542
80
+ mg_pso_gui-0.2.127.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
81
+ mg_pso_gui-0.2.127.dist-info/entry_points.txt,sha256=jg82VOFjR1XDGrchs1wJSCqKYE4Ozv12aBcCSp--koA,117
82
+ mg_pso_gui-0.2.127.dist-info/top_level.txt,sha256=y7JuS9xJN5YdxUsQ3PSVjN8MzQAnR146bP3ZN3PYWdE,9
83
+ mg_pso_gui-0.2.127.dist-info/RECORD,,
mgpsogui/gui/HomePage.py CHANGED
@@ -145,7 +145,7 @@ class App(customtkinter.CTk):
145
145
  self.sidebar_frame.grid_columnconfigure(4, weight=1)
146
146
  self.logo_label = customtkinter.CTkLabel(self.sidebar_frame, text="COSU Manager (" + version + ")", font=customtkinter.CTkFont(size=20, weight="bold"))
147
147
  self.logo_label.grid(row=0, column=0, padx=(20, 10), pady=header_padding_y)
148
- self.save_button = customtkinter.CTkButton(self.sidebar_frame, text="Save", width=60, command=self.save_project)
148
+ self.save_button = customtkinter.CTkButton(self.sidebar_frame, text="Save As", width=60, command=self.save_project)
149
149
  self.save_button.grid(row=0, column=1, padx=header_padding_x, pady=header_padding_y)
150
150
  self.load_button = customtkinter.CTkButton(self.sidebar_frame, text="Load", width=60, command=self.load_project)
151
151
  self.load_button.grid(row=0, column=2, padx=header_padding_x, pady=header_padding_y)
@@ -258,11 +258,11 @@ class App(customtkinter.CTk):
258
258
  os.makedirs(os.path.join(folder, "results"))
259
259
 
260
260
  self.save_button.configure(text="Saved!")
261
- self.after(3000, lambda: self.save_button.configure(text="Save"))
261
+ self.after(3000, lambda: self.save_button.configure(text="Save As"))
262
262
  except Exception as e:
263
263
  self.save_button.configure(text="Error!")
264
264
  print(e)
265
- self.after(3000, lambda: self.save_button.configure(text="Save"))
265
+ self.after(3000, lambda: self.save_button.configure(text="Save As"))
266
266
 
267
267
  def auto_save_project(self):
268
268
  data = self.option_manager.get_project_data()
@@ -281,8 +281,6 @@ class App(customtkinter.CTk):
281
281
  if not os.path.exists(os.path.join(folder, "results")):
282
282
  os.makedirs(os.path.join(folder, "results"))
283
283
 
284
- self.save_button.configure(text="Saved!")
285
- self.after(1000, lambda: self.save_button.configure(text="Save"))
286
284
  except Exception as e:
287
285
  self.save_button.configure(text="Error!")
288
286
  print(e)
@@ -445,6 +443,8 @@ class App(customtkinter.CTk):
445
443
  NW(title="Error", message="A process is already running!", x = 400, y = 200)
446
444
  return 0
447
445
 
446
+ self.auto_save_project()
447
+
448
448
  data = self.option_manager.get_all_data()
449
449
  mode = self.option_manager.get_mode()
450
450
  data = data[mode]
@@ -138,7 +138,7 @@ class ListParametersView(CTkScrollableFrame):
138
138
  row += 1
139
139
 
140
140
  CTkButton(self.containerFrame, text="Open", command=self.open_csv).grid(row=row, column=0, padx=(5, 5), pady=(5, 5), sticky="ew")
141
- CTkButton(self.containerFrame, text="Import", command=self.import_csv).grid(row=row, column=1, padx=(5, 5), pady=(5, 5), sticky="ew")
141
+ CTkButton(self.containerFrame, text="Paste", command=self.import_csv).grid(row=row, column=1, padx=(5, 5), pady=(5, 5), sticky="ew")
142
142
  row += 1
143
143
 
144
144
 
@@ -10,56 +10,25 @@ def csip_worker(reqq: queue.Queue, thread_no: int, stop, full_trace,
10
10
  save_resp = conf.get('save_response_to', None) # save response, set it to a folder if responses should be saved.
11
11
 
12
12
  while not stop():
13
+
13
14
  try:
14
- (rnd, step, iteration, particle, x, step_param, calib_params, objfunc, resq) = reqq.get(True, 0.5)
15
+ (rnd, step, iteration, particle, x, step_param_names, calib_params, objfunc, resq) = reqq.get(True, 0.5)
15
16
  # print(thread_no, particle)
16
-
17
+
17
18
  c = Client(metainfo=metainfo)
18
19
 
19
- all_params = {}
20
-
21
20
  # static params (from args)
22
21
  for param in arg_params:
23
22
  c.add_data(param['name'], param['value'])
24
23
 
25
24
  # particle params (generated from steps)
26
25
  # for i, value in enumerate(x):
27
- # for idx, value in enumerate(x[particle, :]):
28
- # c.add_data(step_param_names[idx], value)
29
- values = x[particle]
30
- idx = 0
31
- for p in step_param:
32
- value_type = p.get('type', 'float')
33
- if 'float' == value_type:
34
- c.add_data(p['name'], values[idx])
35
- all_params[p['name']] = values[idx]
36
- idx = idx + 1
37
- elif 'list' == value_type:
38
- base_name = p['name']
39
- calibration_strategy = p.get('calibration_strategy', 'mean')
40
-
41
- if 'mean' == calibration_strategy:
42
- mean = values[idx]
43
- default_value = p['default_value']
44
- value = [(1 + mean) * x for x in default_value]
45
- c.add_data(base_name, value)
46
- all_params[base_name] = value
47
- idx = idx + 1
48
- elif 'single' == calibration_strategy:
49
- default_value = p['default_value']
50
- sub_index = 0
51
- value = default_value.copy()
52
- while sub_index < len(default_value):
53
- value[sub_index] = values[idx]
54
- idx = idx + 1
55
- sub_index = sub_index + 1
56
- c.add_data(base_name, value)
57
- all_params[base_name] = value
26
+ for idx, value in enumerate(x[particle, :]):
27
+ c.add_data(step_param_names[idx], value)
58
28
 
59
29
  # other, previously calibrated params (other steps)
60
30
  for name, value in calib_params.items():
61
31
  c.add_data(name, value)
62
- all_params[name] = value
63
32
 
64
33
  # objective function info
65
34
  for of in objfunc:
@@ -75,31 +44,31 @@ def csip_worker(reqq: queue.Queue, thread_no: int, stop, full_trace,
75
44
  else:
76
45
  res = c.execute(url, files=files, conf=conf)
77
46
 
78
- # run_string = 'r{}s{}i{}p{}.json'.format(rnd, step, iteration, particle)
47
+ if res.is_failed():
48
+ print(res)
79
49
 
80
50
  if save_resp:
81
51
  res.save_to(os.path.join(save_resp, 'r{}s{}i{}p{}.json'.format(rnd, step, iteration, particle)))
82
-
83
- if res.is_failed():
84
- print(u'F')
85
- # print(res)
86
- resq.put((particle, 100))
87
- else:
88
- # print(res)
89
- # print(u'\u2714', end='', flush=True)
90
- print(u'O', end='', flush=True)
91
- cost = utils.calc_cost(res, objfunc)
92
- resq.put((particle, cost))
93
- # break
52
+
53
+ # print(res)
54
+ print('O', end='', flush=True)
55
+
56
+ cost = utils.calc_cost(res, objfunc)
94
57
 
95
58
  if full_trace is not None:
59
+ all_params = {}
60
+ # for i, value in enumerate(x):
61
+ for idx, value in enumerate(x[particle, :]):
62
+ all_params[step_param_names[idx]] = value
63
+
64
+ for name, value in calib_params.items():
65
+ all_params[name] = value
96
66
  full_trace.append((all_params, cost))
97
67
 
98
68
  resq.put((particle, cost))
99
- except:
100
- print(u'sF')
101
- resq.put((particle, 100))
102
- continue
69
+ except Exception as e:
70
+ print(res)
71
+ print(e)
103
72
 
104
73
  reqq.task_done()
105
74
  except queue.Empty:
@@ -0,0 +1,106 @@
1
+ from cosu import utils
2
+ from csip import Client
3
+ from typing import List, Dict, Tuple
4
+ import queue, os
5
+
6
+
7
+ def csip_worker(reqq: queue.Queue, thread_no: int, stop, full_trace,
8
+ url, files, arg_params, conf: Dict, metainfo: Dict) -> None:
9
+ async_call = conf.get('async_call', True) # default is async
10
+ save_resp = conf.get('save_response_to', None) # save response, set it to a folder if responses should be saved.
11
+
12
+ while not stop():
13
+ try:
14
+ (rnd, step, iteration, particle, x, step_param, calib_params, objfunc, resq) = reqq.get(True, 0.5)
15
+ # print(thread_no, particle)
16
+
17
+ c = Client(metainfo=metainfo)
18
+
19
+ all_params = {}
20
+
21
+ # static params (from args)
22
+ for param in arg_params:
23
+ c.add_data(param['name'], param['value'])
24
+
25
+ # particle params (generated from steps)
26
+ # for i, value in enumerate(x):
27
+ # for idx, value in enumerate(x[particle, :]):
28
+ # c.add_data(step_param_names[idx], value)
29
+ values = x[particle]
30
+ idx = 0
31
+ for p in step_param:
32
+ value_type = p.get('type', 'float')
33
+ if 'float' == value_type:
34
+ c.add_data(p['name'], values[idx])
35
+ all_params[p['name']] = values[idx]
36
+ idx = idx + 1
37
+ elif 'list' == value_type:
38
+ base_name = p['name']
39
+ calibration_strategy = p.get('calibration_strategy', 'mean')
40
+
41
+ if 'mean' == calibration_strategy:
42
+ mean = values[idx]
43
+ default_value = p['default_value']
44
+ value = [(1 + mean) * x for x in default_value]
45
+ c.add_data(base_name, value)
46
+ all_params[base_name] = value
47
+ idx = idx + 1
48
+ elif 'single' == calibration_strategy:
49
+ default_value = p['default_value']
50
+ sub_index = 0
51
+ value = default_value.copy()
52
+ while sub_index < len(default_value):
53
+ value[sub_index] = values[idx]
54
+ idx = idx + 1
55
+ sub_index = sub_index + 1
56
+ c.add_data(base_name, value)
57
+ all_params[base_name] = value
58
+
59
+ # other, previously calibrated params (other steps)
60
+ for name, value in calib_params.items():
61
+ c.add_data(name, value)
62
+ all_params[name] = value
63
+
64
+ # objective function info
65
+ for of in objfunc:
66
+ c.add_cosu(of['name'], of['of'], of['data'])
67
+ # c.add_data(of['name'], (of['data'][0], of['data'][1]))
68
+
69
+ print('.', end='', flush=True)
70
+
71
+ try:
72
+ # print(c)
73
+ if async_call:
74
+ res = c.execute_async(url, files=files, conf=conf)
75
+ else:
76
+ res = c.execute(url, files=files, conf=conf)
77
+
78
+ # run_string = 'r{}s{}i{}p{}.json'.format(rnd, step, iteration, particle)
79
+
80
+ if save_resp:
81
+ res.save_to(os.path.join(save_resp, 'r{}s{}i{}p{}.json'.format(rnd, step, iteration, particle)))
82
+
83
+ if res.is_failed():
84
+ print(u'F')
85
+ # print(res)
86
+ resq.put((particle, 100))
87
+ else:
88
+ # print(res)
89
+ # print(u'\u2714', end='', flush=True)
90
+ print(u'O', end='', flush=True)
91
+ cost = utils.calc_cost(res, objfunc)
92
+ resq.put((particle, cost))
93
+ # break
94
+
95
+ if full_trace is not None:
96
+ full_trace.append((all_params, cost))
97
+
98
+ resq.put((particle, cost))
99
+ except:
100
+ print(u'sF')
101
+ resq.put((particle, 100))
102
+ continue
103
+
104
+ reqq.task_done()
105
+ except queue.Empty:
106
+ continue