Skip to content
Snippets Groups Projects
Commit bb08d99b authored by Guenter Quast's avatar Guenter Quast
Browse files

mcpha.py: show only interesting range if thresholds selected

parent 7b7460d3
No related branches found
No related tags found
No related merge requests found
......@@ -364,12 +364,12 @@ class HstDisplay(QWidget, Ui_HstDisplay):
self.mcpha = mcpha
self.log = log
self.number = number
self.min = 0
self.max = 4095
self.sum = 0
self.time = np.uint64([75e8, 0])
self.factor = 1
self.bins = 4096
self.min = 0
self.max = self.bins - 1
self.buffer = np.zeros(self.bins, np.uint32)
if number == 0:
self.color = "#FFAA00"
......@@ -394,12 +394,13 @@ class HstDisplay(QWidget, Ui_HstDisplay):
# !gq end
x = np.arange(self.bins)
(self.curve,) = self.ax.plot(x, self.buffer, drawstyle="steps-mid", color=self.color)
self.roi = [0, 4095]
self.roi = [0, self.max]
self.line = [None, None]
self.active = [False, False]
self.releaser = [None, None]
self.line[0] = self.ax.axvline(0, picker=True, pickradius=5)
self.line[1] = self.ax.axvline(4095, picker=True, pickradius=5)
# marker lines for roi
self.line[0] = self.ax.axvline(self.min, picker=True, pickradius=5)
self.line[1] = self.ax.axvline(self.max, picker=True, pickradius=5)
# create navigation toolbar
self.toolbar = NavigationToolbar(self.canvas, None, False)
self.toolbar.layout().setSpacing(6)
......@@ -467,6 +468,7 @@ class HstDisplay(QWidget, Ui_HstDisplay):
self.mcpha.set_pha_delay(self.number, 100)
self.mcpha.set_pha_thresholds(self.number, self.min, self.max)
self.mcpha.set_timer(self.number, value)
#
self.resume()
def pause(self):
......@@ -528,10 +530,15 @@ class HstDisplay(QWidget, Ui_HstDisplay):
else:
self.ax.set_ylim(auto=True)
self.ax.set_yscale("linear")
size = self.bins // self.factor
self.ax.set_xlim(-0.05 * size, size * 1.05)
# !gq size = self.bins // self.factor
# self.ax.set_xlim(-0.05 * size, size * 1.05)
mn = self.min // self.factor
mx = self.max // self.factor
xsize = mx - mn
self.ax.set_xlim(mn - 0.03*xsize, mx*1.03)
self.ax.relim()
self.ax.autoscale_view(scalex=True, scaley=True)
#
self.canvas.draw()
def set_bins(self, value):
......@@ -543,6 +550,9 @@ class HstDisplay(QWidget, Ui_HstDisplay):
self.curve.set_xdata(x)
self.curve.set_ydata(y)
self.set_scale(self.logCheck.isChecked())
# gq update roi
self.roi[0] = self.min
self.roi[1] = self.max
self.update_roi()
def set_thresholds(self, checked):
......@@ -553,7 +563,15 @@ class HstDisplay(QWidget, Ui_HstDisplay):
self.max = self.maxValue.value()
else:
self.min = 0
self.max = 4095
self.max = self.bins - 1
mn = self.min // self.factor
mx = self.max // self.factor
xsize = mx - mn
self.ax.set_xlim(mn - 0.025*xsize, mx * 1.025)
# !gq update roi
self.roi[0] = self.min
self.roi[1] = self.max
self.update_roi()
def set_time(self, value):
value = value // 125000
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment