From 1378cf6ac7b4aab1bcb33092db69013b866b4e25 Mon Sep 17 00:00:00 2001 From: Dominik Demuth Date: Mon, 8 May 2023 18:48:08 +0200 Subject: [PATCH] Fitresult accepts label argument as set name --- src/gui_qt/graphs/graphwindow.py | 4 ++-- src/nmreval/fit/result.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui_qt/graphs/graphwindow.py b/src/gui_qt/graphs/graphwindow.py index 91fea37..d4339d7 100644 --- a/src/gui_qt/graphs/graphwindow.py +++ b/src/gui_qt/graphs/graphwindow.py @@ -26,7 +26,7 @@ class QGraphWindow(QtWidgets.QGraphicsView, Ui_GraphWindow): mousePositionChanged = QtCore.pyqtSignal(float, float) mouseDoubleClicked = QtCore.pyqtSignal() positionClicked = QtCore.pyqtSignal(tuple, bool) - aboutToClose = QtCore.pyqtSignal(str) + aboutToClose = QtCore.pyqtSignal(list) counter = itertools.count() @@ -375,7 +375,7 @@ class QGraphWindow(QtWidgets.QGraphicsView, Ui_GraphWindow): QtWidgets.QMessageBox.Yes, QtWidgets.QMessageBox.No) if res == QtWidgets.QMessageBox.Yes: - self.aboutToClose.emit(self.id) + self.aboutToClose.emit([self.id]) evt.accept() else: evt.ignore() diff --git a/src/nmreval/fit/result.py b/src/nmreval/fit/result.py index dcb0b6d..813a7bb 100644 --- a/src/nmreval/fit/result.py +++ b/src/nmreval/fit/result.py @@ -138,8 +138,8 @@ class FitResult(Points): **kwargs): self.parameter, name = self._prepare_names(params, name) - - super().__init__(x=x, y=y, name=name, **kwargs) + label = kwargs.get('label', name) + super().__init__(x=x, y=y, name=label, **kwargs) self.residual = resid self.idx = idx @@ -327,6 +327,7 @@ class FitResult(Points): state[attr] = getattr(self, attr) state['name'] = self._model_name + state['label'] = self.name state['corr'] = self.correlation state['pcorr'] = self.partial_correlation state['stats'] = self.statistics @@ -354,7 +355,6 @@ class FitResult(Points): return new_fit - def sub(self, x_values): part_functions = [] for sub_name, sub_y in zip(self.func.sub_name(), self.func.sub(self.p_final, x_values, **self.fun_kwargs)):