Fitresult accepts label argument as set name

This commit is contained in:
Dominik Demuth 2023-05-08 18:48:08 +02:00
parent a964e02612
commit 1378cf6ac7
2 changed files with 5 additions and 5 deletions

View File

@ -26,7 +26,7 @@ class QGraphWindow(QtWidgets.QGraphicsView, Ui_GraphWindow):
mousePositionChanged = QtCore.pyqtSignal(float, float) mousePositionChanged = QtCore.pyqtSignal(float, float)
mouseDoubleClicked = QtCore.pyqtSignal() mouseDoubleClicked = QtCore.pyqtSignal()
positionClicked = QtCore.pyqtSignal(tuple, bool) positionClicked = QtCore.pyqtSignal(tuple, bool)
aboutToClose = QtCore.pyqtSignal(str) aboutToClose = QtCore.pyqtSignal(list)
counter = itertools.count() counter = itertools.count()
@ -375,7 +375,7 @@ class QGraphWindow(QtWidgets.QGraphicsView, Ui_GraphWindow):
QtWidgets.QMessageBox.Yes, QtWidgets.QMessageBox.No) QtWidgets.QMessageBox.Yes, QtWidgets.QMessageBox.No)
if res == QtWidgets.QMessageBox.Yes: if res == QtWidgets.QMessageBox.Yes:
self.aboutToClose.emit(self.id) self.aboutToClose.emit([self.id])
evt.accept() evt.accept()
else: else:
evt.ignore() evt.ignore()

View File

@ -138,8 +138,8 @@ class FitResult(Points):
**kwargs): **kwargs):
self.parameter, name = self._prepare_names(params, name) self.parameter, name = self._prepare_names(params, name)
label = kwargs.get('label', name)
super().__init__(x=x, y=y, name=name, **kwargs) super().__init__(x=x, y=y, name=label, **kwargs)
self.residual = resid self.residual = resid
self.idx = idx self.idx = idx
@ -327,6 +327,7 @@ class FitResult(Points):
state[attr] = getattr(self, attr) state[attr] = getattr(self, attr)
state['name'] = self._model_name state['name'] = self._model_name
state['label'] = self.name
state['corr'] = self.correlation state['corr'] = self.correlation
state['pcorr'] = self.partial_correlation state['pcorr'] = self.partial_correlation
state['stats'] = self.statistics state['stats'] = self.statistics
@ -354,7 +355,6 @@ class FitResult(Points):
return new_fit return new_fit
def sub(self, x_values): def sub(self, x_values):
part_functions = [] part_functions = []
for sub_name, sub_y in zip(self.func.sub_name(), self.func.sub(self.p_final, x_values, **self.fun_kwargs)): for sub_name, sub_y in zip(self.func.sub_name(), self.func.sub(self.p_final, x_values, **self.fun_kwargs)):