From 22f8bc80ed41169a328ccc9d4ab5257af110ef9a Mon Sep 17 00:00:00 2001 From: Dominik Demuth Date: Mon, 19 Jun 2023 18:15:25 +0200 Subject: [PATCH] concat mask also; closes #84 --- src/gui_qt/data/container.py | 15 ++++++++------- src/gui_qt/main/management.py | 2 +- src/nmreval/data/points.py | 7 +++++-- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/gui_qt/data/container.py b/src/gui_qt/data/container.py index 940ac62..fd268d8 100644 --- a/src/gui_qt/data/container.py +++ b/src/gui_qt/data/container.py @@ -45,6 +45,7 @@ class ExperimentContainer(QtCore.QObject): self.actions = {} self._update_actions() + @plot_update def _init_plot(self): raise NotImplementedError @@ -528,17 +529,17 @@ class PointContainer(ExperimentContainer): line_kwargs['style'] = LineStyle.No sym_kwargs['symbol'] = next(PointContainer.symbols) - self.plot_real = PlotItem(x=self._data.x, y=self._data.y, name=self.name, + self.plot_real = PlotItem(x=self.x, y=self.y, name=self.name, symbol=None, pen=None, connect='finite') self.setSymbol(mode='real', **sym_kwargs) self.setLine(mode='real', **line_kwargs) if sym_kwargs['symbol'] != SymbolStyle.No: - self.plot_error = ErrorBars(x=self._data.x, y=self._data.y, top=self._data.y_err, bottom=self._data.y_err, + self.plot_error = ErrorBars(x=self.x, y=self.y, top=self.y_err, bottom=self.y_err, pen=mkPen({'color': self.plot_real.symbolcolor.rgb()})) else: - self.plot_error = ErrorBars(x=self._data.x, y=self._data.y, top=self._data.y_err, bottom=self._data.y_err, + self.plot_error = ErrorBars(x=self.x, y=self.y, top=self.y_err, bottom=self.y_err, pen=mkPen({'color': self.plot_real.linecolor.rgb()})) @@ -561,12 +562,12 @@ class FitContainer(ExperimentContainer): if isinstance(color, BaseColor): color = color.rgb() - self.plot_real = PlotItem(x=self._data.x, y=self._data.y.real, name=self.name, + self.plot_real = PlotItem(x=self.x, y=self.y.real, name=self.name, pen=mkPen({'color': color}), connect='finite', symbol=None) if np.iscomplexobj(self._data.y): - self.plot_imag = PlotItem(x=self._data.x, y=self._data.y.imag, name=self.name, + self.plot_imag = PlotItem(x=self.x, y=self.y.imag, name=self.name, pen=mkPen({'color': color}), connect='finite', symbol=None) @@ -599,9 +600,9 @@ class SignalContainer(ExperimentContainer): self._init_plot(symbol=symbol, **kwargs) def _init_plot(self, **kwargs): - self.plot_real = PlotItem(x=self._data.x, y=self._data.y.real, name=self.name, + self.plot_real = PlotItem(x=self.x, y=self.y.real, name=self.name, symbol=None, pen=None, connect='finite') - self.plot_imag = PlotItem(x=self._data.x, y=self._data.y.imag, name=self.name, + self.plot_imag = PlotItem(x=self.x, y=self.y.imag, name=self.name, symbol=None, pen=None, connect='finite') color = kwargs.get('color', None) diff --git a/src/gui_qt/main/management.py b/src/gui_qt/main/management.py index a85e4d1..9655835 100644 --- a/src/gui_qt/main/management.py +++ b/src/gui_qt/main/management.py @@ -343,7 +343,7 @@ class UpperManagement(QtCore.QObject): if joined is None: joined = data_i.copy() else: - joined.append(data_i.x, data_i.y, data_i.y_err) + joined.append(data_i.data.x, data_i.data.y, y_err=data_i.data.y_err, mask=data_i.data.mask) name_set.add(data_i.name) group_set.add(data_i.group) diff --git a/src/nmreval/data/points.py b/src/nmreval/data/points.py index c2169ff..671142d 100644 --- a/src/nmreval/data/points.py +++ b/src/nmreval/data/points.py @@ -497,8 +497,11 @@ class Points: return self - def append(self, x: ArrayLike, y: ArrayLike, y_err: ArrayLike = None): - x, y, y_err, mask = self._prepare_xy(x, y, y_err) + def append(self, x: ArrayLike, y: ArrayLike, y_err: ArrayLike = None, mask: ArrayLike = None): + if mask is None: + x, y, y_err, mask = self._prepare_xy(x, y, y_err) + else: + x, y, y_err, _ = self._prepare_xy(x, y, y_err) self._x = np.r_[self._x, x] self._y = np.r_[self._y, y]