display correct start parameter

This commit is contained in:
Dominik Demuth 2023-05-19 15:48:32 +02:00
parent a1ab6335c5
commit 66a0e40a23
2 changed files with 8 additions and 13 deletions

View File

@ -263,17 +263,17 @@ class QFitParameterWidget(QtWidgets.QWidget, Ui_FormFit):
return data_parameter, lb, ub, is_fixed, global_p, is_linked
def set_parameter(self, set_id: str | None, parameter: list[float]) -> int:
param_len = len(list(filter(lambda g: not isinstance(g, SelectionWidget), self.global_parameter)))
num_parameter = list(filter(lambda g: not isinstance(g, SelectionWidget), self.global_parameter))
param_len = len(num_parameter)
if set_id is None:
for val, g in zip(parameter, self.global_parameter):
if isinstance(g, SelectionWidget):
continue
for i, g in enumerate(num_parameter):
val = parameter[i]
g.set_parameter(val)
self.glob_values[i] = val
else:
new_param = self.data_values[set_id]
min_len = min(param_len, len(new_param), len(new_param))
min_len = min(param_len, len(new_param))
for i in range(min_len):
new_param[i] = parameter[i]

View File

@ -77,16 +77,11 @@ class QFitDialog(QtWidgets.QWidget, Ui_FitDialog):
w.deleteLater()
del self.param_widgets[idx]
if len(self.functionwidget) == 0:
self._current_function = None
if len(self.param_widgets) == 0:
# empty model
self.newmodel_button.setEnabled(False)
self.deletemodel_button.setEnabled(False)
self._current_function = None
else:
f_tree = self.functionwidget.functree
func_idx = f_tree.currentItem().data(0, f_tree.counterRole)
self._current_function = self.functionwidget.functions[func_idx]
@QtCore.pyqtSlot(int)
def show_function_parameter(self, function_id: int, function_idx: int = None):