concat mask also; closes #84

This commit is contained in:
Dominik Demuth 2023-06-19 18:15:25 +02:00
parent 1a225b2cd2
commit 22f8bc80ed
3 changed files with 14 additions and 10 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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]