mg-pso-gui 0.1.111__py3-none-any.whl → 0.1.113__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.111
3
+ Version: 0.1.113
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=_gmUz-eE3XIMaykpt88X0sf-pRbpbldfk0h2_aNwSPM,24046
4
+ mgpsogui/gui/HomePage.py,sha256=ckJvKDkUhWrfV6OPSaUgmzlqxdZJYOb5GAqNrFjxArQ,24605
5
5
  mgpsogui/gui/OptionManager.py,sha256=H5ofd7PA5f6dVfSghUhKdPiqLHNE0IVpPPzf93k7JD4,12527
6
6
  mgpsogui/gui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  mgpsogui/gui/PlatformTab/PlatformTab.py,sha256=KyIoHlMKD9nfQqHeGJwRDA4RCoe4UykjB2l6xMTKK_M,10486
@@ -35,7 +35,8 @@ mgpsogui/gui/images/up.png,sha256=AQvFWCUqSQNaQ1E6LKZ9zNfSvW6t4mgy8uswdg9T2Hg,24
35
35
  mgpsogui/util/GraphGenerator.py,sha256=HhUsFUFhCv3wTYV8CTqU0wo56Ph9c1DocPj25AVIAdI,15076
36
36
  mgpsogui/util/PSORunner.py,sha256=Do3-OUH7iZGL6aoCcwsM-6lxof8ERwyKA-_g8rDr_DM,3942
37
37
  mgpsogui/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
- mgpsogui/util/debug.py,sha256=Lfbw7tw0udlc2lq0lkMD3ZseCdP4Nsx3STwIP0p_VL4,5255
38
+ mgpsogui/util/debug.py,sha256=36oZ3wf3_zGQbdZLGwHJ1Kk8QArl9pjNqkIaz6IPt74,19742
39
+ mgpsogui/util/helpers.py,sha256=fCfVDaGholx16FVVqf2BhWs9KCevI7aFIve1w2W68EQ,769
39
40
  mgpsogui/util/CTkToolTip/__init__.py,sha256=G1jxV55hGtGgwyC1sR-uUUdasDdh0XZgcI-aILgGYA0,225
40
41
  mgpsogui/util/CTkToolTip/ctk_tooltip.py,sha256=SZMovpQIGvdpDRbqCKl9SHs92DrFCO2MOYL2ifolvOE,6329
41
42
  mgpsogui/util/recosu/__init__.py,sha256=T7_iigIlowGbPOHLO3hwihjw2kbwIg6olOMhFhNiL38,236
@@ -47,8 +48,8 @@ mgpsogui/util/recosu/utils/trace_writer.py,sha256=V9BJlOjCbNYGoXGEk3CF5wjifBxvar
47
48
  mgpsogui/util/recosu/utils/utils.py,sha256=QB8vftq3142ekG0ORjz0ZBHU5YknXbR0oTsrxrPAsF0,3951
48
49
  mgpsogui/util/recosu/utils/plot/__init__.py,sha256=h1KjM7_tNDv351pcwt8A6Ibb1jhwWyx5Gbu-zj-sI3Q,71
49
50
  mgpsogui/util/recosu/utils/plot/cost_steps.py,sha256=1Ce11AJyweWkmvjXPxEygzS-h8yVLmQEDLS53yjPLqQ,3779
50
- mg_pso_gui-0.1.111.dist-info/METADATA,sha256=xP5bF-qW_m6knmnDp7ULaeiNGbIGTZgCesHyyGQ617Q,9459
51
- mg_pso_gui-0.1.111.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
52
- mg_pso_gui-0.1.111.dist-info/entry_points.txt,sha256=jg82VOFjR1XDGrchs1wJSCqKYE4Ozv12aBcCSp--koA,117
53
- mg_pso_gui-0.1.111.dist-info/top_level.txt,sha256=y7JuS9xJN5YdxUsQ3PSVjN8MzQAnR146bP3ZN3PYWdE,9
54
- mg_pso_gui-0.1.111.dist-info/RECORD,,
51
+ mg_pso_gui-0.1.113.dist-info/METADATA,sha256=vXvLYdDq78LaCnarZZuiKcjFd34R9pETcCmfVc25fbw,9459
52
+ mg_pso_gui-0.1.113.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
53
+ mg_pso_gui-0.1.113.dist-info/entry_points.txt,sha256=jg82VOFjR1XDGrchs1wJSCqKYE4Ozv12aBcCSp--koA,117
54
+ mg_pso_gui-0.1.113.dist-info/top_level.txt,sha256=y7JuS9xJN5YdxUsQ3PSVjN8MzQAnR146bP3ZN3PYWdE,9
55
+ mg_pso_gui-0.1.113.dist-info/RECORD,,
mgpsogui/gui/HomePage.py CHANGED
@@ -31,6 +31,7 @@ from queue import Empty
31
31
  from ..util import PSORunner
32
32
  from ..util import GraphGenerator
33
33
  from ..util.CTkToolTip import CTkToolTip as ctt
34
+ from ..util import helpers as hp
34
35
 
35
36
  import subprocess
36
37
  import plotly.express as px
@@ -334,7 +335,7 @@ class App(customtkinter.CTk):
334
335
  self.load_button.configure(text="Loaded!")
335
336
  self.after(3000, lambda: self.load_button.configure(text="Load"))
336
337
 
337
- self.make_request()
338
+ self.load()
338
339
 
339
340
  except Exception as e:
340
341
  print(e)
@@ -535,6 +536,24 @@ class App(customtkinter.CTk):
535
536
  trace = results_queue.get_nowait()
536
537
 
537
538
  print("TRACE " + str(trace), flush=True)
539
+
540
+ final_results = hp.extract_final_round_values(trace)
541
+ print("Final results: " + str(final_results), flush=True)
542
+
543
+ all_steps = self.option_manager.get_steps()
544
+ data = final_results["data"]
545
+ index = 0
546
+ for step in data:
547
+ for param in step.keys():
548
+ value = step[param]
549
+ target_step = all_steps[index]
550
+ for target_param in target_step['param']:
551
+ if target_param['name'] == param:
552
+ target_param['optimal_value'].set(value)
553
+ index += 1
554
+ print("Applied optimal values")
555
+
556
+
538
557
  except Empty:
539
558
  break
540
559
  except Exception as e:
@@ -650,9 +669,6 @@ class App(customtkinter.CTk):
650
669
  self.progress_message_right.configure(text="")
651
670
  self.textbox.insert("0.0", "\nCalibration finished!\n")
652
671
 
653
-
654
-
655
-
656
672
  def start():
657
673
  app = App()
658
674
  app.mainloop()
mgpsogui/util/debug.py CHANGED
@@ -2,125 +2,558 @@ from recosu.pso import global_best
2
2
 
3
3
  # 1) COSU steps, definition of parameters to calibrate
4
4
  steps = [
5
- { # step 1
6
- 'param': [
7
- {
8
- 'name': 'soilOutLPS',
9
- 'bounds': (0.0, 2.0)
10
- },
5
+ { # step 1
6
+ "param": [
7
+ {"name": "soilOutLPS", "bounds": (0.0, 2.0)},
8
+ {"name": "lagInterflow", "bounds": (10.0, 80.0)},
9
+ ],
10
+ "objfunc": [
11
11
  {
12
- 'name': 'lagInterflow',
13
- 'bounds': (10.0, 80.0)
12
+ "name": "ns", # Name (Must be unique)
13
+ "of": "ns", # Objective Function
14
+ "data": (
15
+ "obs_data02_14.csv/obs/orun[1]",
16
+ "output/csip_run/out/Outlet.csv/output/catchmentSimRunoff",
17
+ )
18
+ # Optional Weight parameter. If not specified it is 1 or evenly distributed between all objective functions
14
19
  }
15
20
  ],
16
- 'objfunc': [
21
+ },
22
+ { # step 2
23
+ "param": [
24
+ {"name": "flowRouteTA", "bounds": (0.4, 5.0)},
25
+ {"name": "soilMaxDPS", "bounds": (0.0, 5.0)},
26
+ ],
27
+ "objfunc": [
17
28
  {
18
- 'name': 'ns', # Name (Must be unique)
19
- 'of':'ns', # Objective Function
20
- 'data': ('obs_data02_14.csv/obs/orun[1]',
21
- 'output/csip_run/out/Outlet.csv/output/catchmentSimRunoff')
22
- # Optional Weight parameter. If not specified it is 1 or evenly distributed between all objective functions
29
+ "name": "ns",
30
+ "of": "ns",
31
+ "data": (
32
+ "obs_data02_14.csv/obs/orun[1]",
33
+ "output/csip_run/out/Outlet.csv/output/catchmentSimRunoff",
34
+ ),
23
35
  }
24
- ]
36
+ ],
25
37
  },
26
- { # step 2
27
- 'param': [
38
+ ]
39
+
40
+ steps = [
41
+ {
42
+ "param": [
28
43
  {
29
- 'name': 'flowRouteTA',
30
- 'bounds': (0.4, 5.0)
44
+ "name": "soilOutLPS",
45
+ "bounds": (0.0, 2.0),
46
+ "default_value": 1.0,
47
+ "optimal_value": 0.0,
48
+ "type": "float",
49
+ "calibration_strategy": "none",
31
50
  },
32
51
  {
33
- 'name': 'soilMaxDPS',
34
- 'bounds': (0.0, 5.0)
52
+ "name": "lagInterflow",
53
+ "bounds": (10.0, 80.0),
54
+ "default_value": 1.0,
55
+ "optimal_value": 0.0,
56
+ "type": "float",
57
+ "calibration_strategy": "none",
58
+ },
59
+ ],
60
+ "objfunc": [
61
+ {
62
+ "name": "ns",
63
+ "of": "ns",
64
+ "weight": 1.0,
65
+ "data": (
66
+ "obs_data02_14.csv/obs/orun[1]",
67
+ "output/csip_run/out/Outlet.csv/output/catchmentSimRunoff",
68
+ ),
35
69
  }
36
70
  ],
37
- 'objfunc': [
71
+ },
72
+ {
73
+ "param": [
74
+ {
75
+ "name": "flowRouteTA",
76
+ "bounds": (0.4, 5.0),
77
+ "default_value": 1.0,
78
+ "optimal_value": 0.0,
79
+ "type": "float",
80
+ "calibration_strategy": "none",
81
+ },
38
82
  {
39
- 'name': 'ns',
40
- 'of':'ns',
41
- 'data': ('obs_data02_14.csv/obs/orun[1]',
42
- 'output/csip_run/out/Outlet.csv/output/catchmentSimRunoff')
83
+ "name": "soilMaxDPS",
84
+ "bounds": (0.0, 5.0),
85
+ "default_value": 1.0,
86
+ "optimal_value": 0.0,
87
+ "type": "float",
88
+ "calibration_strategy": "none",
89
+ },
90
+ ],
91
+ "objfunc": [
92
+ {
93
+ "name": "ns",
94
+ "of": "ns",
95
+ "weight": 1.0,
96
+ "data": (
97
+ "obs_data02_14.csv/obs/orun[1]",
98
+ "output/csip_run/out/Outlet.csv/output/catchmentSimRunoff",
99
+ ),
43
100
  }
44
- ]
45
- }
101
+ ],
102
+ },
46
103
  ]
47
104
 
48
- steps = [{'param': [{'name': 'soilOutLPS', 'bounds': (0.0, 2.0), 'default_value': 1.0, 'optimal_value': 0.0, 'type': 'float', 'calibration_strategy': 'none'}, {'name': 'lagInterflow', 'bounds': (10.0, 80.0), 'default_value': 1.0, 'optimal_value': 0.0, 'type': 'float', 'calibration_strategy': 'none'}], 'objfunc': [{'name': 'ns', 'of': 'ns', 'weight': 1.0, 'data': ('obs_data02_14.csv/obs/orun[1]', 'output/csip_run/out/Outlet.csv/output/catchmentSimRunoff')}]}, {'param': [{'name': 'flowRouteTA', 'bounds': (0.4, 5.0), 'default_value': 1.0, 'optimal_value': 0.0, 'type': 'float', 'calibration_strategy': 'none'}, {'name': 'soilMaxDPS', 'bounds': (0.0, 5.0), 'default_value': 1.0, 'optimal_value': 0.0, 'type': 'float', 'calibration_strategy': 'none'}], 'objfunc': [{'name': 'ns', 'of': 'ns', 'weight': 1.0, 'data': ('obs_data02_14.csv/obs/orun[1]', 'output/csip_run/out/Outlet.csv/output/catchmentSimRunoff')}]}]
49
-
50
105
  # 2) static ages parameters
51
106
  args = {
52
- 'param': [
53
- {
54
- "name": "startTime",
55
- "value": "2002-01-01"
56
- },
57
- {
58
- "name": "endTime",
59
- "value": "2006-12-31"
60
- },
61
- {
62
- "name": "dataStartTime",
63
- "value": "2002-01-01"
64
- },
65
- {
66
- "name": "dataEndTime",
67
- "value": "2006-12-31"
68
- },
69
- {
70
- "name": "cal_startTime",
71
- "value": "2003-01-01"
72
- },
73
- {
74
- "name": "cal_endTime",
75
- "value": "2006-12-31"
76
- },
77
- {
78
- "name": "parallelismThreads",
79
- "value": "2"
80
- },
81
- {
82
- "name": "flagLoadState",
83
- "value": "True"
84
- },
85
- {
86
- "name": "payload",
87
- "value": "false"
88
- },
89
- {
90
- "name": "project",
91
- "value": "SFIR3"
92
- }
107
+ "param": [
108
+ {"name": "startTime", "value": "2002-01-01"},
109
+ {"name": "endTime", "value": "2006-12-31"},
110
+ {"name": "dataStartTime", "value": "2002-01-01"},
111
+ {"name": "dataEndTime", "value": "2006-12-31"},
112
+ {"name": "cal_startTime", "value": "2003-01-01"},
113
+ {"name": "cal_endTime", "value": "2006-12-31"},
114
+ {"name": "parallelismThreads", "value": "2"},
115
+ {"name": "flagLoadState", "value": "True"},
116
+ {"name": "payload", "value": "false"},
117
+ {"name": "project", "value": "SFIR3"},
93
118
  ],
94
119
  # the service url
95
- 'url': 'http://csip.engr.colostate.edu:8087/csip-oms/m/ages/0.3.0',
96
-
120
+ "url": "http://csip.engr.colostate.edu:8087/csip-oms/m/ages/0.3.0",
97
121
  # the files to attach for each run
98
- 'files': {}
122
+ "files": {},
99
123
  }
100
124
 
101
- args = {'param': [{'name': 'startTime', 'value': '2002-01-01'}, {'name': 'endTime', 'value': '2006-12-31'}, {'name': 'dataStartTime', 'value': '2002-01-01'}, {'name': 'dataEndTime', 'value': '2006-12-31'}, {'name': 'cal_startTime', 'value': '2003-01-01'}, {'name': 'cal_endTime', 'value': '2006-12-31'}, {'name': 'parallelismThreads', 'value': '2'}, {'name': 'flagLoadState', 'value': 'True'}, {'name': 'payload', 'value': 'false'}, {'name': 'project', 'value': 'SFIR3'}], 'url': 'http://csip.engr.colostate.edu:8087/csip-oms/m/ages/0.3.0', 'mode': 'PSO', 'files': {}}
125
+ args = {
126
+ "param": [
127
+ {"name": "startTime", "value": "2002-01-01"},
128
+ {"name": "endTime", "value": "2006-12-31"},
129
+ {"name": "dataStartTime", "value": "2002-01-01"},
130
+ {"name": "dataEndTime", "value": "2006-12-31"},
131
+ {"name": "cal_startTime", "value": "2003-01-01"},
132
+ {"name": "cal_endTime", "value": "2006-12-31"},
133
+ {"name": "parallelismThreads", "value": "2"},
134
+ {"name": "flagLoadState", "value": "True"},
135
+ {"name": "payload", "value": "false"},
136
+ {"name": "project", "value": "SFIR3"},
137
+ ],
138
+ "url": "http://csip.engr.colostate.edu:8087/csip-oms/m/ages/0.3.0",
139
+ "mode": "PSO",
140
+ "files": {},
141
+ }
102
142
 
103
143
  if "mode" in args:
104
144
  del args["mode"]
105
145
 
106
146
  # 3. perform optimization
107
- optimizer, trace = global_best(steps, # step definition
108
- rounds=(1, 2), # min/max number of rounds
109
- args=args, # static arguments
110
- n_particles=10, # number of particle candidates for each param
111
- iters=20, # max # of iterations
112
- n_threads=10, # number of threads to use
113
- # ftol=0.00000001, # min cost function delta for convergence
114
- options={'c1': 2, 'c2': 2, 'w': 0.8}, # hyperparameter
115
- oh_strategy={ "w":'adaptive', "c1":'adaptive',"c2":'adaptive'}, # adaptive hyperparameter adjustments based on current and max # of iterations
116
- conf={
117
- 'service_timeout': 400.0,
118
- 'http_retry': 5,
119
- 'http_allow_redirects': True,
120
- 'async_call': False,
121
- 'http_conn_timeout': 10,
122
- 'http_read_timeout': 400,
123
- 'particles_fail': 5,
124
- 'step_trace': './step_trace.json'
147
+ optimizer, trace = global_best(
148
+ steps, # step definition
149
+ rounds=(1, 2), # min/max number of rounds
150
+ args=args, # static arguments
151
+ n_particles=10, # number of particle candidates for each param
152
+ iters=20, # max # of iterations
153
+ n_threads=10, # number of threads to use
154
+ # ftol=0.00000001, # min cost function delta for convergence
155
+ options={"c1": 2, "c2": 2, "w": 0.8}, # hyperparameter
156
+ oh_strategy={
157
+ "w": "adaptive",
158
+ "c1": "adaptive",
159
+ "c2": "adaptive",
160
+ }, # adaptive hyperparameter adjustments based on current and max # of iterations
161
+ conf={
162
+ "service_timeout": 400.0,
163
+ "http_retry": 5,
164
+ "http_allow_redirects": True,
165
+ "async_call": False,
166
+ "http_conn_timeout": 10,
167
+ "http_read_timeout": 400,
168
+ "particles_fail": 5,
169
+ "step_trace": "./step_trace.json",
170
+ },
171
+ )
172
+
173
+ step_trace = {
174
+ "dir": "/Users/robertcordingly/Library/Python/3.8/lib/python/site-packages/mgpsogui/gui",
175
+ "start": "2024-05-28 14:25:53.793407",
176
+ "min_rounds": 1,
177
+ "max_rounds": 2,
178
+ "iters": 20,
179
+ "ftol": "-inf",
180
+ "ftol_iter": 1,
181
+ "rtol": 0.001,
182
+ "rtol_iter": 1,
183
+ "n_threads": 10,
184
+ "n_particles": 10,
185
+ "n_steps": 2,
186
+ "steps": [
187
+ {
188
+ "param": [
189
+ {
190
+ "name": "soilOutLPS",
191
+ "bounds": (0.0, 2.0),
192
+ "default_value": 1.0,
193
+ "optimal_value": 0.0,
194
+ "type": "float",
195
+ "calibration_strategy": "none",
196
+ },
197
+ {
198
+ "name": "lagInterflow",
199
+ "bounds": (10.0, 80.0),
200
+ "default_value": 1.0,
201
+ "optimal_value": 0.0,
202
+ "type": "float",
203
+ "calibration_strategy": "none",
204
+ },
205
+ ],
206
+ "objfunc": [
207
+ {
208
+ "name": "ns",
209
+ "of": "ns",
210
+ "weight": 1.0,
211
+ "data": (
212
+ "obs_data02_14.csv/obs/orun[1]",
213
+ "output/csip_run/out/Outlet.csv/output/catchmentSimRunoff",
214
+ ),
215
+ }
216
+ ],
217
+ },
218
+ {
219
+ "param": [
220
+ {
221
+ "name": "flowRouteTA",
222
+ "bounds": (0.4, 5.0),
223
+ "default_value": 1.0,
224
+ "optimal_value": 0.0,
225
+ "type": "float",
226
+ "calibration_strategy": "none",
227
+ },
228
+ {
229
+ "name": "soilMaxDPS",
230
+ "bounds": (0.0, 5.0),
231
+ "default_value": 1.0,
232
+ "optimal_value": 0.0,
233
+ "type": "float",
234
+ "calibration_strategy": "none",
235
+ },
236
+ ],
237
+ "objfunc": [
238
+ {
239
+ "name": "ns",
240
+ "of": "ns",
241
+ "weight": 1.0,
242
+ "data": (
243
+ "obs_data02_14.csv/obs/orun[1]",
244
+ "output/csip_run/out/Outlet.csv/output/catchmentSimRunoff",
245
+ ),
246
+ }
247
+ ],
248
+ },
249
+ ],
250
+ "args": "{'param': [{'name': 'startTime', 'value': '2002-01-01'}, {'name': 'endTime', 'value': '2006-12-31'}, {'name': 'dataStartTime', 'value': '2002-01-01'}, {'name': 'dataEndTime', 'value': '2006-12-31'}, {'name': 'cal_startTime', 'value': '2003-01-01'}, {'name': 'cal_endTime', 'value': '2006-12-31'}, {'name': 'parallelismThreads', 'value': '2'}, {'name': 'flagLoadState', 'value': 'True'}, {'name': 'payload', 'value': 'false'}, {'name': 'project', 'value': 'SFIR3'}], 'url': 'http://csip.engr.colostate.edu:8087/csip-oms/m/ages/0.3.0', 'files': {}}",
251
+ "r1s1": {
252
+ "time": "2024-05-28 14:28:27.648143",
253
+ "best_costs": [0.4962544759194877, "inf"],
254
+ "steps": [
255
+ {
256
+ "param": [
257
+ {
258
+ "name": "soilOutLPS",
259
+ "bounds": (0.0, 2.0),
260
+ "default_value": 1.0,
261
+ "optimal_value": 0.0,
262
+ "type": "float",
263
+ "calibration_strategy": "none",
264
+ "value": 1.4277364777450963,
265
+ },
266
+ {
267
+ "name": "lagInterflow",
268
+ "bounds": (10.0, 80.0),
269
+ "default_value": 1.0,
270
+ "optimal_value": 0.0,
271
+ "type": "float",
272
+ "calibration_strategy": "none",
273
+ "value": 65.31198215742819,
274
+ },
275
+ ],
276
+ "objfunc": [
277
+ {
278
+ "name": "ns",
279
+ "of": "ns",
280
+ "weight": 1.0,
281
+ "data": (
282
+ "obs_data02_14.csv/obs/orun[1]",
283
+ "output/csip_run/out/Outlet.csv/output/catchmentSimRunoff",
284
+ ),
285
+ }
286
+ ],
287
+ "cost": 0.4962544759194877,
288
+ },
289
+ {
290
+ "param": [
291
+ {
292
+ "name": "flowRouteTA",
293
+ "bounds": (0.4, 5.0),
294
+ "default_value": 1.0,
295
+ "optimal_value": 0.0,
296
+ "type": "float",
297
+ "calibration_strategy": "none",
298
+ },
299
+ {
300
+ "name": "soilMaxDPS",
301
+ "bounds": (0.0, 5.0),
302
+ "default_value": 1.0,
303
+ "optimal_value": 0.0,
304
+ "type": "float",
305
+ "calibration_strategy": "none",
306
+ },
307
+ ],
308
+ "objfunc": [
309
+ {
310
+ "name": "ns",
311
+ "of": "ns",
312
+ "weight": 1.0,
313
+ "data": (
314
+ "obs_data02_14.csv/obs/orun[1]",
315
+ "output/csip_run/out/Outlet.csv/output/catchmentSimRunoff",
316
+ ),
125
317
  }
126
- )
318
+ ],
319
+ },
320
+ ],
321
+ },
322
+ "r1s2": {
323
+ "time": "2024-05-28 14:30:53.464613",
324
+ "best_costs": [0.4962544759194877, 0.4159144385219078],
325
+ "steps": [
326
+ {
327
+ "param": [
328
+ {
329
+ "name": "soilOutLPS",
330
+ "bounds": (0.0, 2.0),
331
+ "default_value": 1.0,
332
+ "optimal_value": 0.0,
333
+ "type": "float",
334
+ "calibration_strategy": "none",
335
+ "value": 1.4277364777450963,
336
+ },
337
+ {
338
+ "name": "lagInterflow",
339
+ "bounds": (10.0, 80.0),
340
+ "default_value": 1.0,
341
+ "optimal_value": 0.0,
342
+ "type": "float",
343
+ "calibration_strategy": "none",
344
+ "value": 65.31198215742819,
345
+ },
346
+ ],
347
+ "objfunc": [
348
+ {
349
+ "name": "ns",
350
+ "of": "ns",
351
+ "weight": 1.0,
352
+ "data": (
353
+ "obs_data02_14.csv/obs/orun[1]",
354
+ "output/csip_run/out/Outlet.csv/output/catchmentSimRunoff",
355
+ ),
356
+ }
357
+ ],
358
+ "cost": 0.4962544759194877,
359
+ },
360
+ {
361
+ "param": [
362
+ {
363
+ "name": "flowRouteTA",
364
+ "bounds": (0.4, 5.0),
365
+ "default_value": 1.0,
366
+ "optimal_value": 0.0,
367
+ "type": "float",
368
+ "calibration_strategy": "none",
369
+ "value": 1.9846472555222765,
370
+ },
371
+ {
372
+ "name": "soilMaxDPS",
373
+ "bounds": (0.0, 5.0),
374
+ "default_value": 1.0,
375
+ "optimal_value": 0.0,
376
+ "type": "float",
377
+ "calibration_strategy": "none",
378
+ "value": 4.619363774024649,
379
+ },
380
+ ],
381
+ "objfunc": [
382
+ {
383
+ "name": "ns",
384
+ "of": "ns",
385
+ "weight": 1.0,
386
+ "data": (
387
+ "obs_data02_14.csv/obs/orun[1]",
388
+ "output/csip_run/out/Outlet.csv/output/catchmentSimRunoff",
389
+ ),
390
+ }
391
+ ],
392
+ "cost": 0.4159144385219078,
393
+ },
394
+ ],
395
+ },
396
+ "r1": {
397
+ "time": "2024-05-28 14:30:53.465478",
398
+ "round_cost": 0.9121689144413955,
399
+ "best_costs": [0.4962544759194877, 0.4159144385219078],
400
+ "improvements": [False, False],
401
+ },
402
+ "r2s1": {
403
+ "time": "2024-05-28 14:33:23.457742",
404
+ "best_costs": [0.41218845540212334, 0.4159144385219078],
405
+ "steps": [
406
+ {
407
+ "param": [
408
+ {
409
+ "name": "soilOutLPS",
410
+ "bounds": (0.0, 2.0),
411
+ "default_value": 1.0,
412
+ "optimal_value": 0.0,
413
+ "type": "float",
414
+ "calibration_strategy": "none",
415
+ "value": 1.3832527609622032,
416
+ },
417
+ {
418
+ "name": "lagInterflow",
419
+ "bounds": (10.0, 80.0),
420
+ "default_value": 1.0,
421
+ "optimal_value": 0.0,
422
+ "type": "float",
423
+ "calibration_strategy": "none",
424
+ "value": 71.21736822883048,
425
+ },
426
+ ],
427
+ "objfunc": [
428
+ {
429
+ "name": "ns",
430
+ "of": "ns",
431
+ "weight": 1.0,
432
+ "data": (
433
+ "obs_data02_14.csv/obs/orun[1]",
434
+ "output/csip_run/out/Outlet.csv/output/catchmentSimRunoff",
435
+ ),
436
+ }
437
+ ],
438
+ "cost": 0.41218845540212334,
439
+ },
440
+ {
441
+ "param": [
442
+ {
443
+ "name": "flowRouteTA",
444
+ "bounds": (0.4, 5.0),
445
+ "default_value": 1.0,
446
+ "optimal_value": 0.0,
447
+ "type": "float",
448
+ "calibration_strategy": "none",
449
+ "value": 1.9846472555222765,
450
+ },
451
+ {
452
+ "name": "soilMaxDPS",
453
+ "bounds": (0.0, 5.0),
454
+ "default_value": 1.0,
455
+ "optimal_value": 0.0,
456
+ "type": "float",
457
+ "calibration_strategy": "none",
458
+ "value": 4.619363774024649,
459
+ },
460
+ ],
461
+ "objfunc": [
462
+ {
463
+ "name": "ns",
464
+ "of": "ns",
465
+ "weight": 1.0,
466
+ "data": (
467
+ "obs_data02_14.csv/obs/orun[1]",
468
+ "output/csip_run/out/Outlet.csv/output/catchmentSimRunoff",
469
+ ),
470
+ }
471
+ ],
472
+ "cost": 0.4159144385219078,
473
+ },
474
+ ],
475
+ },
476
+ "r2s2": {
477
+ "time": "2024-05-28 14:35:50.514486",
478
+ "best_costs": [0.41218845540212334, 0.4121061580572347],
479
+ "steps": [
480
+ {
481
+ "param": [
482
+ {
483
+ "name": "soilOutLPS",
484
+ "bounds": (0.0, 2.0),
485
+ "default_value": 1.0,
486
+ "optimal_value": 0.0,
487
+ "type": "float",
488
+ "calibration_strategy": "none",
489
+ "value": 1.3832527609622032,
490
+ },
491
+ {
492
+ "name": "lagInterflow",
493
+ "bounds": (10.0, 80.0),
494
+ "default_value": 1.0,
495
+ "optimal_value": 0.0,
496
+ "type": "float",
497
+ "calibration_strategy": "none",
498
+ "value": 71.21736822883048,
499
+ },
500
+ ],
501
+ "objfunc": [
502
+ {
503
+ "name": "ns",
504
+ "of": "ns",
505
+ "weight": 1.0,
506
+ "data": (
507
+ "obs_data02_14.csv/obs/orun[1]",
508
+ "output/csip_run/out/Outlet.csv/output/catchmentSimRunoff",
509
+ ),
510
+ }
511
+ ],
512
+ "cost": 0.41218845540212334,
513
+ },
514
+ {
515
+ "param": [
516
+ {
517
+ "name": "flowRouteTA",
518
+ "bounds": (0.4, 5.0),
519
+ "default_value": 1.0,
520
+ "optimal_value": 0.0,
521
+ "type": "float",
522
+ "calibration_strategy": "none",
523
+ "value": 1.9461260670740506,
524
+ },
525
+ {
526
+ "name": "soilMaxDPS",
527
+ "bounds": (0.0, 5.0),
528
+ "default_value": 1.0,
529
+ "optimal_value": 0.0,
530
+ "type": "float",
531
+ "calibration_strategy": "none",
532
+ "value": 3.7734465992198514,
533
+ },
534
+ ],
535
+ "objfunc": [
536
+ {
537
+ "name": "ns",
538
+ "of": "ns",
539
+ "weight": 1.0,
540
+ "data": (
541
+ "obs_data02_14.csv/obs/orun[1]",
542
+ "output/csip_run/out/Outlet.csv/output/catchmentSimRunoff",
543
+ ),
544
+ }
545
+ ],
546
+ "cost": 0.4121061580572347,
547
+ },
548
+ ],
549
+ },
550
+ "r2": {
551
+ "time": "2024-05-28 14:35:50.521162",
552
+ "round_cost": 0.8242946134593581,
553
+ "best_costs": [0.41218845540212334, 0.4121061580572347],
554
+ "improvements": [False, False],
555
+ },
556
+ "rounds": 2,
557
+ "end": "2024-05-28 14:35:51.017597",
558
+ "time": "0:09:56.726582",
559
+ }
@@ -0,0 +1,22 @@
1
+ def extract_final_round_values(data):
2
+ max_rounds = data['max_rounds'] + 1
3
+ steps = data['n_steps'] + 1
4
+
5
+ final_value = {}
6
+
7
+ for round in range(max_rounds):
8
+ for step in range(steps):
9
+ key = f"r{round}s{step}"
10
+ if key in data:
11
+ obj = data[key]
12
+ round_steps = []
13
+ for o_step in obj['steps']:
14
+ step_obj = {}
15
+ for param in o_step['param']:
16
+ if 'name' in param and 'value' in param:
17
+ step_obj[param['name']] = param['value']
18
+
19
+ round_steps.append(step_obj)
20
+ final_value["data"] = round_steps
21
+ final_value["index"] = key
22
+ return final_value