forked from IPKM/nmreval
display correct start parameter
This commit is contained in:
parent
a1ab6335c5
commit
66a0e40a23
@ -263,17 +263,17 @@ class QFitParameterWidget(QtWidgets.QWidget, Ui_FormFit):
|
|||||||
return data_parameter, lb, ub, is_fixed, global_p, is_linked
|
return data_parameter, lb, ub, is_fixed, global_p, is_linked
|
||||||
|
|
||||||
def set_parameter(self, set_id: str | None, parameter: list[float]) -> int:
|
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:
|
if set_id is None:
|
||||||
for val, g in zip(parameter, self.global_parameter):
|
for i, g in enumerate(num_parameter):
|
||||||
if isinstance(g, SelectionWidget):
|
val = parameter[i]
|
||||||
continue
|
|
||||||
g.set_parameter(val)
|
g.set_parameter(val)
|
||||||
|
self.glob_values[i] = val
|
||||||
|
|
||||||
else:
|
else:
|
||||||
new_param = self.data_values[set_id]
|
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):
|
for i in range(min_len):
|
||||||
new_param[i] = parameter[i]
|
new_param[i] = parameter[i]
|
||||||
|
|
||||||
|
@ -77,16 +77,11 @@ class QFitDialog(QtWidgets.QWidget, Ui_FitDialog):
|
|||||||
w.deleteLater()
|
w.deleteLater()
|
||||||
del self.param_widgets[idx]
|
del self.param_widgets[idx]
|
||||||
|
|
||||||
if len(self.functionwidget) == 0:
|
self._current_function = None
|
||||||
|
if len(self.param_widgets) == 0:
|
||||||
# empty model
|
# empty model
|
||||||
self.newmodel_button.setEnabled(False)
|
self.newmodel_button.setEnabled(False)
|
||||||
self.deletemodel_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)
|
@QtCore.pyqtSlot(int)
|
||||||
def show_function_parameter(self, function_id: int, function_idx: int = None):
|
def show_function_parameter(self, function_id: int, function_idx: int = None):
|
||||||
|
Loading…
Reference in New Issue
Block a user