|
@@ -406,7 +406,7 @@ class SubPlotWidget(pg.GraphicsLayoutWidget):
|
|
|
|
|
|
|
|
|
|
|
|
- def plotPeak(self, data):
|
|
|
+ def plotPeak(self, data)
|
|
|
"""
|
|
|
Plot the datapoints of all available ADCs as time-series data and
|
|
|
optionally do a polyfit between the points to visualize an
|
|
@@ -419,14 +419,14 @@ class SubPlotWidget(pg.GraphicsLayoutWidget):
|
|
|
self.img.clear()
|
|
|
self.plotItemPlotScatter.show()
|
|
|
self.plotItemPlotScatter1.show()
|
|
|
-
|
|
|
+
|
|
|
baseline = []
|
|
|
- #doFit = 6 if self.fittGauss.isChecked() else 0
|
|
|
+ doFit = 6 if self.fittGauss.isChecked() else 0
|
|
|
|
|
|
#Currently not supported / cleanup required
|
|
|
#if doFit > 0:
|
|
|
if False:
|
|
|
-
|
|
|
+
|
|
|
x = np.reshape(data[0][0], (-1, doFit))
|
|
|
y = np.reshape(data[0][1], (-1, doFit))
|
|
|
|
|
@@ -435,21 +435,21 @@ class SubPlotWidget(pg.GraphicsLayoutWidget):
|
|
|
positive = np.abs(valmax) > np.abs(valmin)
|
|
|
#print('positive', positive)
|
|
|
|
|
|
-
|
|
|
+
|
|
|
tmp = y.T
|
|
|
for line in tmp:
|
|
|
if positive:
|
|
|
baseline.append(np.mean(line[np.where(line < 15)]))
|
|
|
else:
|
|
|
baseline.append(np.mean(line[np.where(line > -15)]))
|
|
|
-
|
|
|
+
|
|
|
#print(baseline)
|
|
|
y = y-baseline
|
|
|
-
|
|
|
+
|
|
|
def gauss(x, sigma, mu, A):
|
|
|
return A*np.exp(-0.5*((x-mu)/sigma)**2)
|
|
|
|
|
|
- fitx = np.linspace(np.min(x[0])*0.5, np.max(x[0])*1.5, 25)
|
|
|
+ fitx = np.linspace(np.min(x[0])*0.5, np.max(x[0])*1.5, 25)
|
|
|
for i, line in enumerate(x):
|
|
|
if len(self.plotItemFit) < i+1:
|
|
|
item = pg.PlotDataItem(pen=pg.mkPen(QColor(192, 57, 43), width=0.5), autoDownsample=True, clipToView=True )
|
|
@@ -467,19 +467,14 @@ class SubPlotWidget(pg.GraphicsLayoutWidget):
|
|
|
traceback.print_exc()
|
|
|
pass
|
|
|
|
|
|
- #Deactivatedf for now
|
|
|
- #if doFit:
|
|
|
- if False:
|
|
|
+ if doFit:
|
|
|
self.plotItemPlotScatter.setData(np.reshape(x,-1), np.reshape(y,-1))
|
|
|
- else:
|
|
|
+ else:
|
|
|
self.plotItemPlotScatter.setData(data[0].transpose())
|
|
|
self.plotItemPlotScatter1.setData(data[1].transpose())
|
|
|
- #ScatterPlots just want a tuple of two arrays, and combines them
|
|
|
- #together to form X,Y coordinate pairs.
|
|
|
-
|
|
|
-
|
|
|
- #self._enableCustomAutoRange(data[0][1])
|
|
|
- self.plotItem.setClipToView(True)
|
|
|
+
|
|
|
+ self._enableCustomAutoRange(data[0][1])
|
|
|
+ self.plotItem.setClipToView(False)
|
|
|
|
|
|
|
|
|
|
|
@@ -523,13 +518,13 @@ class SubPlotWidget(pg.GraphicsLayoutWidget):
|
|
|
#self.plotItemPlotScatter2.clear()
|
|
|
#self.plotItem.resetTransform()
|
|
|
#self.plotItem.getAxis('bottom').setScale()
|
|
|
-
|
|
|
+
|
|
|
|
|
|
self.img.clear()
|
|
|
self.img2.clear()
|
|
|
self.img.hide()
|
|
|
self.img2.hide()
|
|
|
-
|
|
|
+
|
|
|
self.gradient_legend.hide()
|
|
|
try:
|
|
|
self.removeItem(self.gradient_legend)
|
|
@@ -537,7 +532,7 @@ class SubPlotWidget(pg.GraphicsLayoutWidget):
|
|
|
except Exception as e:
|
|
|
if not "Could not determine index of item" in str(e):
|
|
|
raise
|
|
|
-
|
|
|
+
|
|
|
|
|
|
if self._type_changed:
|
|
|
#self.plotItem.autoBtnClicked()
|
|
@@ -597,7 +592,7 @@ class SubPlotWidget(pg.GraphicsLayoutWidget):
|
|
|
if len(data) < 9:
|
|
|
data= data[0]
|
|
|
data = np.abs(data).transpose()
|
|
|
-
|
|
|
+
|
|
|
self.addItem(self.gradient_legend)
|
|
|
|
|
|
self.gradient_legend.show()
|
|
@@ -623,7 +618,7 @@ class SubPlotWidget(pg.GraphicsLayoutWidget):
|
|
|
self.plotItem.setClipToView(True)
|
|
|
|
|
|
if self.plotType == PlotType.Heatmap:
|
|
|
-
|
|
|
+
|
|
|
self.addItem(self.gradient_legend)
|
|
|
|
|
|
self.gradient_legend.show()
|
|
@@ -687,7 +682,7 @@ class SubPlotWidget(pg.GraphicsLayoutWidget):
|
|
|
self.plotItem.setClipToView(True)
|
|
|
|
|
|
if self.plotType == PlotType.Trains:
|
|
|
-
|
|
|
+
|
|
|
if len(data) < 9:
|
|
|
maxv = 0
|
|
|
minv = 4000
|
|
@@ -712,12 +707,12 @@ class SubPlotWidget(pg.GraphicsLayoutWidget):
|
|
|
self.plotItemPlot[0].setData(data)
|
|
|
|
|
|
self._enableCustomAutoRange(data)
|
|
|
-
|
|
|
+
|
|
|
if self.plotType in [PlotType.Combined]:
|
|
|
self.img.clear()
|
|
|
self.plotItemPlotScatter.show()
|
|
|
self.plotItemPlotScatter1.show()
|
|
|
-
|
|
|
+
|
|
|
self.plotItemPlotScatter.setData(data[0].transpose())
|
|
|
self.plotItemPlotScatter1.setData(data[1].transpose())
|
|
|
|
|
@@ -739,7 +734,7 @@ class SubPlotWidget(pg.GraphicsLayoutWidget):
|
|
|
self.error_label.show()
|
|
|
else:
|
|
|
self.no_data_label.show()
|
|
|
-
|
|
|
+
|
|
|
|
|
|
if autorange:
|
|
|
self.plotItem.getViewBox().autoRange()
|
|
@@ -893,7 +888,7 @@ class PlotWidget(kcgw.KCGWidgets):
|
|
|
self.adcCheckBox.append(self.createCheckbox(text="ADC "+str(i+1), connect=self.change_adc, color=colours[i]))
|
|
|
self.adc_checkbox_layout.addWidget(self.adcCheckBox[i])
|
|
|
self.group.addButton(self.adcCheckBox[i], i+1)
|
|
|
-
|
|
|
+
|
|
|
self.adcCheckBox[0].setChecked(True)
|
|
|
self.groupWidget = QtGui.QWidget()
|
|
|
self.groupWidget.setLayout(self.adc_checkbox_layout)
|
|
@@ -943,20 +938,20 @@ class PlotWidget(kcgw.KCGWidgets):
|
|
|
|
|
|
self.groupWidgetCompare.hide()
|
|
|
|
|
|
-
|
|
|
+
|
|
|
self.fft_mode = QtGui.QComboBox(self)
|
|
|
self.fft_mode.addItem("Image") #0
|
|
|
self.fft_mode.addItem("All") #1
|
|
|
self.fft_mode.addItem("Mean") #1
|
|
|
for i in range(184):
|
|
|
- self.fft_mode.addItem("Bucket {}".format(i))
|
|
|
+ self.fft_mode.addItem("Bucket {}".format(i))
|
|
|
self.fft_mode.currentIndexChanged.connect(lambda: [self.change_adc(), self.changePlotType(self.theType)])
|
|
|
self.fft_log = self.createCheckbox(text="Log", connect=lambda: self.change_adc())
|
|
|
|
|
|
self.from_to_layout = QtGui.QHBoxLayout()
|
|
|
self.from_spinbox = self.createSpinbox(0, 100000000, interval=100, connect=lambda: self.plot(self.theType))
|
|
|
self.to_spinbox = self.createSpinbox(0, 100000000, start_value=1000, interval=100, connect=lambda: self.plot(self.theType))
|
|
|
-
|
|
|
+
|
|
|
self.from_to_layout.addWidget(self.fft_mode)
|
|
|
self.from_to_layout.addWidget(self.fft_log)
|
|
|
self.from_to_layout.addStretch()
|
|
@@ -998,7 +993,7 @@ class PlotWidget(kcgw.KCGWidgets):
|
|
|
self.adcCheckBox[0].setChecked(True)
|
|
|
else:
|
|
|
self.adc = self.group.checkedId()-1
|
|
|
-
|
|
|
+
|
|
|
self.change_identifier_text()
|
|
|
self.plot(self.theType)
|
|
|
|
|
@@ -1059,8 +1054,8 @@ class PlotWidget(kcgw.KCGWidgets):
|
|
|
style += self.defaultButtonStyleSheet
|
|
|
style += "QPushButton:focus{background-color: lightgrey!important; border-color: lightblue;}" # Note: this does not work
|
|
|
button.setStyleSheet(style)
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
if self.theType == PlotType.Trains:
|
|
|
self.group.setExclusive(False)
|
|
|
else:
|
|
@@ -1075,12 +1070,12 @@ class PlotWidget(kcgw.KCGWidgets):
|
|
|
else:
|
|
|
self.makeMean.hide()
|
|
|
self.fittGauss.hide()
|
|
|
-
|
|
|
+
|
|
|
if self.theType == PlotType.FFT:
|
|
|
self.fft_mode.show()
|
|
|
self.fft_log.show()
|
|
|
if self.fft_mode.currentIndex() > 0:
|
|
|
- self.group.setExclusive(False)
|
|
|
+ self.group.setExclusive(False)
|
|
|
else:
|
|
|
self.group.setExclusive(True)
|
|
|
else:
|
|
@@ -1102,7 +1097,7 @@ class PlotWidget(kcgw.KCGWidgets):
|
|
|
self.do_plot(type)
|
|
|
except Exception as e:
|
|
|
print('plot wrapper except')
|
|
|
-
|
|
|
+
|
|
|
traceback.print_exc()
|
|
|
if self.data is None or len(self.data.array) == 0:
|
|
|
self.changePlotType(NO_DATA)
|