mg-pso-gui 0.0.1__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.
@@ -0,0 +1,215 @@
1
+ import plotly.express as px
2
+ import plotly.graph_objs as go
3
+ import pandas as pd
4
+ import numpy as np
5
+
6
+ def best_cost_stacked(config, dataframe):
7
+ fig = go.Figure()
8
+
9
+ total_steps = len(config)
10
+
11
+ # Get unique values from the round_step column of the dataframe
12
+ for iteration in dataframe['round_step'].unique():
13
+ # Get best_cost and completed rounds rows for this iteration
14
+ df = dataframe[dataframe['round_step'] == iteration]
15
+
16
+ step_index = ((iteration) % total_steps)
17
+ round_index = ((iteration) // total_steps)
18
+
19
+ fig.add_trace(go.Scatter(x=df['completed_rounds'], y=df['best_cost'], name='Round ' + str(round_index + 1) + ' Step ' + str(step_index + 1)))
20
+
21
+ fig.update_layout(
22
+ title="",
23
+ xaxis_title="Iteration",
24
+ yaxis_title="Best Cost",
25
+ font=dict(color='white'),
26
+ paper_bgcolor='rgba(42, 42, 42, 0)',
27
+ plot_bgcolor='rgb(62, 62, 62)',
28
+ xaxis=dict(
29
+ gridcolor='rgb(72, 72, 72)',
30
+ gridwidth=1
31
+ ),
32
+ yaxis=dict(
33
+ range=[0, 0.6],
34
+ autorange='reversed',
35
+ gridcolor='rgb(72, 72, 72)',
36
+ gridwidth=0.1
37
+ )
38
+ )
39
+
40
+ fig.write_image("./best_cost_stacked.png", width=1280, height=720)
41
+ fig.write_html("./best_cost_stacked.html", include_plotlyjs='cdn', auto_open=False)
42
+ with open("./best_cost_stacked.html", "r") as f:
43
+ html = f.read()
44
+ html = html.replace("<body>", "<body bgcolor='#2a2a2a'>")
45
+ with open("./best_cost_stacked.html", "w") as f:
46
+ f.write(html)
47
+
48
+ return fig
49
+
50
+ def table(config, dataframe):
51
+ # Create a plotly table with the values in the dataframe
52
+ fig = go.Figure(data=[go.Table(
53
+ header=dict(
54
+ values=list(dataframe.columns),
55
+ font=dict(color='black'),
56
+ align="left"
57
+ ),
58
+ cells=dict(
59
+ values=[dataframe[k].tolist() for k in dataframe.columns],
60
+ font=dict(color='black'),
61
+ align = "left")
62
+ )])
63
+
64
+ fig.update_layout(
65
+ title="",
66
+ xaxis_title="Iteration",
67
+ yaxis_title="Best Cost",
68
+ font=dict(color='white'),
69
+ paper_bgcolor='rgba(42, 42, 42, 0)',
70
+ plot_bgcolor='rgb(62, 62, 62)',
71
+ xaxis=dict(
72
+ gridcolor='rgb(72, 72, 72)',
73
+ gridwidth=1
74
+ ),
75
+ yaxis=dict(
76
+ range=[0, 0.6],
77
+ autorange='reversed',
78
+ gridcolor='rgb(72, 72, 72)',
79
+ gridwidth=0.1
80
+ )
81
+ )
82
+
83
+ fig.write_image("./table.png", width=1280, height=720)
84
+ fig.write_html("./table.html", include_plotlyjs='cdn', auto_open=False)
85
+ with open("./table.html", "r") as f:
86
+ html = f.read()
87
+ html = html.replace("<body>", "<body bgcolor='#2a2a2a'>")
88
+ with open("./table.html", "w") as f:
89
+ f.write(html)
90
+
91
+ return fig
92
+
93
+ def best_cost_by_round(config, dataframe):
94
+ fig = go.Figure()
95
+
96
+ total_steps = len(config)
97
+
98
+ # Get unique values from the round_step column of the dataframe
99
+ for iteration in dataframe['round_step'].unique():
100
+ # Get best_cost and completed rounds rows for this iteration
101
+ df = dataframe[dataframe['round_step'] == iteration]
102
+
103
+ step_index = ((iteration) % total_steps)
104
+ round_index = ((iteration) // total_steps)
105
+
106
+ fig.add_trace(go.Scatter(x=df['completed_rounds'] + (df['total_rounds'] * round_index), y=df['best_cost'], name='Step ' + str(step_index + 1)))
107
+
108
+ xx = np.max(df['completed_rounds']) + (np.max(df['total_rounds']) * round_index)
109
+ fig.add_shape(
110
+ type='line',
111
+ x0=xx,
112
+ y0=0,
113
+ x1=xx,
114
+ y1=1,
115
+ yref='paper',
116
+ line=dict(
117
+ color='rgb(102, 102, 102)',
118
+ width=2
119
+ )
120
+ )
121
+
122
+ fig.add_annotation(
123
+ x=xx + 0.5,
124
+ y=1,
125
+ yref='paper',
126
+ text='Round ' + str(round_index + 1),
127
+ showarrow=False,
128
+ yshift=-10
129
+ )
130
+
131
+ fig.update_layout(
132
+ title="",
133
+ xaxis_title="Iteration",
134
+ yaxis_title="Best Cost",
135
+ font=dict(color='white'),
136
+ paper_bgcolor='rgba(42, 42, 42, 0)',
137
+ plot_bgcolor='rgb(62, 62, 62)',
138
+ xaxis=dict(
139
+ gridcolor='rgb(72, 72, 72)',
140
+ gridwidth=1
141
+ ),
142
+ yaxis=dict(
143
+ range=[0, 0.6],
144
+ autorange='reversed',
145
+ gridcolor='rgb(72, 72, 72)',
146
+ gridwidth=0.1
147
+ )
148
+ )
149
+
150
+ fig.write_image("./best_cost_by_round.png", width=1280, height=720)
151
+ fig.write_html("./best_cost_by_round.html", include_plotlyjs='cdn', auto_open=False)
152
+ with open("./best_cost_by_round.html", "r") as f:
153
+ html = f.read()
154
+ html = html.replace("<body>", "<body bgcolor='#2a2a2a'>")
155
+ with open("./best_cost_by_round.html", "w") as f:
156
+ f.write(html)
157
+
158
+ return fig
159
+
160
+ def calibrated_params_by_round(config, list_of_objs):
161
+ fig = go.Figure()
162
+
163
+ total_steps = len(config)
164
+
165
+ datalines = {"step": [], "round": []}
166
+ step = 1
167
+ round = 1
168
+ for index, obj in enumerate(list_of_objs):
169
+ if (obj == {}):
170
+ continue
171
+ for key in obj.keys():
172
+ if key not in datalines:
173
+ datalines[key] = []
174
+ datalines[key].append(obj[key])
175
+ datalines["step"].append(step)
176
+ datalines['round'].append(round)
177
+ step += 1
178
+ if (step > total_steps):
179
+ step = 1
180
+ round += 1
181
+
182
+ # Get unique values from the round_step column of the dataframe
183
+ for key in datalines.keys():
184
+ # Get best_cost and completed rounds rows for this iteration
185
+ if key == 'step' or key == 'round':
186
+ continue
187
+
188
+ fig.add_trace(go.Scatter(x=datalines['round'], y=datalines[key], name=key))
189
+
190
+ fig.update_layout(
191
+ title="",
192
+ xaxis_title="Round",
193
+ yaxis_title="Particle Parameters",
194
+ font=dict(color='white'),
195
+ paper_bgcolor='rgba(42, 42, 42, 0)',
196
+ plot_bgcolor='rgb(62, 62, 62)',
197
+ xaxis=dict(
198
+ gridcolor='rgb(72, 72, 72)',
199
+ gridwidth=1
200
+ ),
201
+ yaxis=dict(
202
+ gridcolor='rgb(72, 72, 72)',
203
+ gridwidth=0.1
204
+ )
205
+ )
206
+
207
+ fig.write_image("./calibrated_params_by_round.png", width=1280, height=720)
208
+ fig.write_html("./calibrated_params_by_round.html", include_plotlyjs='cdn', auto_open=False)
209
+ with open("./calibrated_params_by_round.html", "r") as f:
210
+ html = f.read()
211
+ html = html.replace("<body>", "<body bgcolor='#2a2a2a'>")
212
+ with open("./calibrated_params_by_round.html", "w") as f:
213
+ f.write(html)
214
+
215
+ return fig
@@ -0,0 +1,173 @@
1
+ from customtkinter import CTkScrollableFrame
2
+ from customtkinter import CTkFrame
3
+ from customtkinter import CTkLabel
4
+ from customtkinter import CTkButton
5
+ from customtkinter import CTkEntry
6
+ import tkinter as tk
7
+ import subprocess
8
+
9
+ global option_manager
10
+
11
+ class ListParametersView(CTkScrollableFrame):
12
+ def __init__(self, *args,
13
+ option_manager: None,
14
+ step_index: 0,
15
+ bound_index: 0,
16
+ **kwargs):
17
+ super().__init__(*args, **kwargs)
18
+
19
+ self.option_manager = option_manager
20
+ self.step_index = step_index
21
+ self.bounds_index = bound_index
22
+ self.key_values = []
23
+ self.visual_name = tk.StringVar()
24
+ self.visual_name.set("name")
25
+
26
+
27
+ self.name = self.option_manager.get_steps()[self.step_index]["param"][bound_index]["name"].get()
28
+ self.default = self.option_manager.get_steps()[self.step_index]["param"][bound_index]["default_value"].get()
29
+ try:
30
+ if self.name != "" and self.default != "":
31
+
32
+ self.visual_name.set(self.name.rsplit('/', 1)[0] + '/')
33
+ self.names = self.name.split('/')
34
+ self.rows = self.names[-1].split(';')
35
+ self.defaults = self.default.replace("[", "").replace("]", "").replace("(", "").replace(")", "").replace(" ", "").split(",")
36
+
37
+ print("rows", self.rows)
38
+ print("defaults", self.defaults)
39
+ index = 0
40
+
41
+ for name in self.rows:
42
+ obj = {"name": tk.StringVar(), "value": tk.StringVar()}
43
+ obj['name'].set(name)
44
+ obj['value'].set(self.defaults[index])
45
+ self.key_values.append(obj)
46
+ index += 1
47
+ except Exception as e:
48
+ print(e)
49
+
50
+ if (len(self.key_values) == 0):
51
+ self.add_key()
52
+
53
+ self.edit_mode = False
54
+
55
+ self.render()
56
+
57
+ def clear(self):
58
+ self.containerFrame.destroy()
59
+
60
+ def toggle_edit_mode(self):
61
+ self.clear()
62
+ self.edit_mode = not self.edit_mode
63
+ self.render()
64
+
65
+ def add_key(self, key="0000", value="0"):
66
+ obj = {"name": tk.StringVar(), "value": tk.StringVar()}
67
+ obj['name'].set(key)
68
+ obj['value'].set(value)
69
+ self.key_values.append(obj)
70
+
71
+ def remove_key(self, index):
72
+ self.key_values.pop(index)
73
+
74
+ def open_csv(self):
75
+ # Shell out to the terminal and run "open ./example.html"
76
+ path = self.visual_name.get()
77
+ path = path.replace(" ", "")
78
+ file_path = path.split("/")[0]
79
+ subprocess.run(["open", "./" + file_path])
80
+
81
+ def import_csv(self):
82
+ # Get data from the clipboard using Tkinter
83
+ data = self.clipboard_get()
84
+
85
+ lines = data.split('\n')
86
+
87
+ # Initialize empty lists for the two columns
88
+ column1 = []
89
+ column2 = []
90
+
91
+ # Loop through each line and split it into two values
92
+ for line in lines:
93
+ if line.strip() != '':
94
+ values = line.split()
95
+ column1.append(values[0])
96
+ column2.append(values[1])
97
+
98
+ # Print the two columns
99
+ print(column1)
100
+ print(column2)
101
+
102
+ if (len(column1) == len(column2)):
103
+ self.clear()
104
+ index = 0
105
+ for name in column1:
106
+ self.add_key(name, column2[index])
107
+ index += 1
108
+ self.render()
109
+
110
+
111
+ def render(self):
112
+ row = 0
113
+ index = 0
114
+
115
+ self.containerFrame = CTkFrame(self)
116
+ self.containerFrame.grid(row=0, column=0, padx=(5, 5), pady=(5, 5), sticky="nsew")
117
+ self.containerFrame.grid_columnconfigure((0, 1), weight=1)
118
+
119
+ CTkLabel(self.containerFrame, text="Path:").grid(row=row, column=0, columnspan=2, padx=5, pady=5, sticky="")
120
+ row += 1
121
+
122
+ self.path_name = CTkEntry(self.containerFrame, textvariable=self.visual_name)
123
+ self.path_name.grid(row=row, column=0, columnspan=2, padx=(5, 5), pady=(5, 5), sticky="ew")
124
+ row += 1
125
+
126
+ CTkButton(self.containerFrame, text="Open", command=self.open_csv).grid(row=row, column=0, padx=(5, 5), pady=(5, 5), sticky="ew")
127
+ CTkButton(self.containerFrame, text="Import", command=self.import_csv).grid(row=row, column=1, padx=(5, 5), pady=(5, 5), sticky="ew")
128
+ row += 1
129
+
130
+
131
+ CTkLabel(self.containerFrame, text="Row:").grid(row=row, column=0, columnspan=1, padx=5, pady=5, sticky="")
132
+ CTkLabel(self.containerFrame, text="Default:").grid(row=row, column=1, columnspan=1, padx=5, pady=5, sticky="")
133
+ row += 1
134
+
135
+ for key_value_pair in self.key_values:
136
+ CTkEntry(self.containerFrame, textvariable=self.key_values[index]["name"]).grid(row=row, column=0, padx=(5, 5), pady=(5, 5), sticky="ew")
137
+
138
+ if self.edit_mode:
139
+ return_func = lambda index=index: (self.clear(), self.remove_key(index), self.render())
140
+ CTkButton(self.containerFrame, text="Remove", command=return_func).grid(row=row, column=1, padx=(5, 5), pady=(5, 5), sticky="ew")
141
+ else:
142
+ bb = CTkEntry(self.containerFrame)
143
+ bb.grid(row=row, column=1, padx=(5, 5), pady=(5, 5), sticky="ew")
144
+ bb.configure(textvariable=self.key_values[index]["value"])
145
+ row += 1
146
+ index += 1
147
+
148
+ if self.edit_mode:
149
+ CTkButton(self.containerFrame, text="Exit", command=self.toggle_edit_mode).grid(row=row, column=0, padx=(5, 5), pady=(5, 5), sticky="ew")
150
+ else:
151
+ CTkButton(self.containerFrame, text="Edit", command=self.toggle_edit_mode).grid(row=row, column=0, padx=(5, 5), pady=(5, 5), sticky="ew")
152
+
153
+ add_key_func = lambda: (self.clear(), self.add_key(), self.render())
154
+ CTkButton(self.containerFrame, text="Add", command=add_key_func).grid(row=row, column=1, padx=(5, 5), pady=(5, 5), sticky="ew")
155
+
156
+ row += 1
157
+
158
+ def push_to_option_manager(self):
159
+ visual_name = self.visual_name.get()
160
+ default_values = "["
161
+ first = True
162
+ for key_value_pair in self.key_values:
163
+ if first:
164
+ visual_name += key_value_pair['name'].get()
165
+ first = False
166
+ else:
167
+ visual_name += ";" + key_value_pair['name'].get()
168
+ default_values += key_value_pair['value'].get() + ","
169
+
170
+ default_values = default_values[:-1] + "]"
171
+
172
+ self.option_manager.get_steps()[self.step_index]["param"][self.bounds_index]["name"].set(visual_name)
173
+ self.option_manager.get_steps()[self.step_index]["param"][self.bounds_index]["default_value"].set(default_values)
@@ -0,0 +1,259 @@
1
+ from tkinter import StringVar as sv
2
+ from tkinter import IntVar as iv
3
+ from tkinter import BooleanVar as bv
4
+ from tkinter import DoubleVar as dv
5
+ import json
6
+
7
+ class OptionManager():
8
+
9
+ def __init__(self):
10
+
11
+ self.project_data = {"name": sv()}
12
+ self.arguments = {"param": [],
13
+ "url": sv(),
14
+ "files": {},
15
+ "calibration_parameters": []}
16
+ self.steps = []
17
+ self.service_parameters = {}
18
+
19
+ def clear(self):
20
+ self.arguments['param'].clear()
21
+ self.arguments['url'].set("")
22
+ self.arguments['files'] = {}
23
+ self.arguments['calibration_parameters'].clear()
24
+ self.steps = []
25
+ self.service_parameters = {}
26
+
27
+ def add_arguments(self, arguments):
28
+
29
+ if ("url" in arguments):
30
+ self.arguments["url"].set(arguments["url"])
31
+
32
+ if ("files" in arguments):
33
+ for file in arguments["files"]:
34
+ name = file["name"]
35
+ value = file["value"]
36
+ obj = {"name": sv(), "value": sv()}
37
+ obj["name"].set(name)
38
+ obj["value"].set(value)
39
+ self.arguments["files"][name] = obj
40
+
41
+ for param in arguments["param"]:
42
+ name = param["name"]
43
+ value = param["value"]
44
+ obj = {"name": sv(), "value": sv()}
45
+ obj["name"].set(name)
46
+ obj["value"].set(value)
47
+ self.arguments["param"].append(obj)
48
+
49
+ for param in arguments["calibration_parameters"]:
50
+ name = param["name"]
51
+ value = param["value"]
52
+ obj = {"name": sv(), "value": sv()}
53
+ obj["name"].set(name)
54
+ obj["value"].set(value)
55
+ self.arguments["calibration_parameters"].append(obj)
56
+
57
+ def add_steps(self, steps):
58
+ for step in steps:
59
+ obj = {"param": [], "objfunc": [], "name": sv(), "message": sv(), "open": False}
60
+ obj["name"].set("Step " + str(len(self.steps) + 1))
61
+ obj["message"].set("Wow")
62
+
63
+ for param in step["param"]:
64
+ param_obj = {
65
+ "name": sv(),
66
+ "bounds": (sv(), sv()),
67
+ "default_value": sv(),
68
+ "type": sv(),
69
+ "calibration_strategy": sv()
70
+ }
71
+ param_obj["name"].set(param["name"])
72
+ if "bounds" in param:
73
+ param_obj["bounds"][0].set(param["bounds"][0])
74
+ param_obj["bounds"][1].set(param["bounds"][1])
75
+ else:
76
+ param_obj["bounds"][0].set(0)
77
+ param_obj["bounds"][1].set(1)
78
+ if "type" in param:
79
+ param_obj["type"].set(param["type"])
80
+ else:
81
+ param_obj["type"].set("float")
82
+ if "default_value" in param:
83
+ param_obj["default_value"].set(param["default_value"])
84
+ else:
85
+ param_obj["default_value"].set(1)
86
+ if "calibration_strategy" in param:
87
+ param_obj["calibration_strategy"].set(param["calibration_strategy"])
88
+ else:
89
+ param_obj["calibration_strategy"].set("none")
90
+ obj["param"].append(param_obj)
91
+
92
+ for objfunc in step["objfunc"]:
93
+ objfunc_obj = {"name": sv(), "of": sv(), "weight": sv(), "data": (sv(), sv())}
94
+ objfunc_obj["name"].set(objfunc["name"])
95
+ objfunc_obj["of"].set(objfunc["of"])
96
+
97
+ if ("weight" in objfunc):
98
+ objfunc_obj["weight"].set(objfunc["weight"])
99
+ else:
100
+ objfunc_obj["weight"].set(1)
101
+
102
+ objfunc_obj["data"][0].set(objfunc["data"][0])
103
+ objfunc_obj["data"][1].set(objfunc["data"][1])
104
+ obj["objfunc"].append(objfunc_obj)
105
+
106
+ self.steps.append(obj)
107
+
108
+ def add_function(self, step_index):
109
+ obj = {"name": sv(), "of": sv(), "weight": sv(), "data": (sv(), sv())}
110
+ obj["name"].set("ns")
111
+ obj["of"].set("ns")
112
+ obj["weight"].set(1)
113
+ obj["data"][0].set("")
114
+ obj["data"][1].set("")
115
+ self.steps[step_index]["objfunc"].append(obj)
116
+
117
+ def remove_function(self, step_index, index):
118
+ self.steps[step_index]["objfunc"].pop(index)
119
+
120
+ def add_bound(self, step_index,
121
+ name="name",
122
+ min=0,
123
+ max=1,
124
+ type="float",
125
+ default_value=1,
126
+ calibration_strategy="none"):
127
+ obj = {
128
+ "name": sv(),
129
+ "bounds": (sv(), sv()),
130
+ "default_value": sv(),
131
+ "type": sv(),
132
+ "calibration_strategy": sv()
133
+ }
134
+ obj["name"].set(name)
135
+ obj["type"].set(type)
136
+ obj["default_value"].set(default_value)
137
+ obj["calibration_strategy"].set(calibration_strategy)
138
+ obj["bounds"][0].set(min)
139
+ obj["bounds"][1].set(max)
140
+ self.steps[step_index]["param"].append(obj)
141
+
142
+ def remove_bound(self, step_index, index):
143
+ self.steps[step_index]["param"].pop(index)
144
+
145
+ def add_argument(self, key, value):
146
+ obj = {"name": sv(), "value": sv()}
147
+ obj["name"].set(key)
148
+ obj["value"].set(value)
149
+ self.arguments["param"].append(obj)
150
+
151
+ def add_calibration_param(self, key, value):
152
+ obj = {"name": sv(), "value": sv()}
153
+ obj["name"].set(key)
154
+ obj["value"].set(value)
155
+ self.arguments["calibration_parameters"].append(obj)
156
+
157
+ def move_argument_up(self, index):
158
+ if index > 0:
159
+ self.arguments["param"][index], self.arguments["param"][index - 1] = self.arguments["param"][index - 1], self.arguments["param"][index]
160
+
161
+ def move_argument_down(self, index):
162
+ if index < len(self.arguments["param"]) - 1:
163
+ self.arguments["param"][index], self.arguments["param"][index + 1] = self.arguments["param"][index + 1], self.arguments["param"][index]
164
+
165
+ def move_step_up(self, index):
166
+ if index > 0:
167
+ self.steps[index], self.steps[index - 1] = self.steps[index - 1], self.steps[index]
168
+
169
+ def move_step_down(self, index):
170
+ if index < len(self.steps) - 1:
171
+ self.steps[index], self.steps[index + 1] = self.steps[index + 1], self.steps[index]
172
+
173
+ def toggle_step_open(self, index):
174
+ self.steps[index]["open"] = not self.steps[index]["open"]
175
+
176
+ def remove_argument(self, index):
177
+ self.arguments["param"].pop(index)
178
+
179
+ def remove_calibration_parameter(self, index):
180
+ self.arguments["calibration_parameters"].pop(index)
181
+
182
+ def remove_step(self, index):
183
+ self.steps.pop(index)
184
+
185
+ def get_arguments(self):
186
+ return self.arguments
187
+
188
+ def get_steps(self):
189
+ return self.steps
190
+
191
+
192
+ def get_all_as_json(self):
193
+ obj = {"arguments": self.arguments, "steps": self.steps}
194
+ return obj
195
+
196
+
197
+ def get_metrics(self):
198
+ result = {}
199
+ result['arguments'] = {}
200
+ result['calibration_parameters'] = []
201
+ for key, value in self.arguments.items():
202
+ if key == 'url':
203
+ result['arguments'][key] = value.get()
204
+ elif key == 'files':
205
+ result['arguments'][key] = {}
206
+ #for name, obj in value.items():
207
+ # result['arguments'][key].append({'name': obj['name'].get(), 'value': obj['value'].get()})
208
+ elif key == 'param':
209
+ result['arguments'][key] = []
210
+ for obj in value:
211
+ result['arguments'][key].append({'name': obj['name'].get(), 'value': obj['value'].get()})
212
+ elif key == "calibration_parameters":
213
+ #result['calibration_parameters'][key] = []
214
+ for obj in value:
215
+ result['calibration_parameters'].append({'name': obj['name'].get(), 'value': obj['value'].get()})
216
+ result['steps'] = []
217
+ for step in self.steps:
218
+ step_result = {}
219
+ #step_result['name'] = step['name'].get()
220
+ #step_result['open'] = step['open']
221
+ step_result['param'] = []
222
+ for param in step['param']:
223
+ # try converting the bounds to numbers
224
+ #try:
225
+ if param['type'].get() == 'float':
226
+ step_result['param'].append(
227
+ {
228
+ 'name': param['name'].get(),
229
+ 'bounds': (float(param['bounds'][0].get()),
230
+ float(param['bounds'][1].get())),
231
+ 'default_value': float(param['default_value'].get()),
232
+ 'type': 'float',
233
+ 'calibration_strategy': param['calibration_strategy'].get()
234
+ }
235
+ )
236
+ elif param['type'].get() == 'list':
237
+ step_result['param'].append(
238
+ {
239
+ 'name': param['name'].get(),
240
+ 'bounds': (float(param['bounds'][0].get()),
241
+ float(param['bounds'][1].get())),
242
+ 'default_value': param['default_value'].get(),
243
+ 'type': 'list',
244
+ 'calibration_strategy': param['calibration_strategy'].get()
245
+ }
246
+ )
247
+ #except ValueError:
248
+ # step_result['param'].append(
249
+ # {
250
+ # 'name': param['name'].get(),
251
+ # 'bounds': (param['bounds'][0].get(),
252
+ # param['bounds'][1].get())
253
+ # }
254
+ # )
255
+ step_result['objfunc'] = []
256
+ for objfunc in step['objfunc']:
257
+ step_result['objfunc'].append({'name': objfunc['name'].get(), 'of': objfunc['of'].get(), 'weight': float(objfunc['weight'].get()), 'data': (objfunc['data'][0].get(), objfunc['data'][1].get())})
258
+ result['steps'].append(step_result)
259
+ return result