Skip to content

Commit

Permalink
Merge pull request #19 from TITUS-EVD/develop
Browse files Browse the repository at this point in the history
Arapuca drawing and bug fixes
  • Loading branch information
marcodeltutto authored Sep 23, 2020
2 parents 8bd4803 + a177f9c commit ecc5560
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 28 deletions.
2 changes: 1 addition & 1 deletion UserDev/EventDisplay/python/evdmanager/evdmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def goToEvent(self, event, force=False):
while event != self._data_manager.eventEntry():
self._data_manager.next()
else:
print("Selected event is too high")
print(f"Selected event is too high. You have requested event {event}, but there is a maximum of {self._n_entries}.")
return

self.setEvent(self._data_manager.eventEntry())
Expand Down
2 changes: 2 additions & 0 deletions UserDev/EventDisplay/python/gui/file_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ def __init__(self,
self._timer.setInterval(self._delay * 1000)
self._timer.timeout.connect(self._callback)

self._callback()

if self._do_check:
self._start_timer()

Expand Down
2 changes: 2 additions & 0 deletions UserDev/EventDisplay/python/gui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ def update(self):
self._subrunLabel.setText(subrunLabel)

self._view_manager.drawPlanes(self._event_manager)
self._view_manager.drawOpDetWvf(self._event_manager)
self.autoRangeWorker()

# This function prepares the buttons such as prev, next, etc and returns a layout
Expand Down Expand Up @@ -1110,6 +1111,7 @@ def initUI(self):

# ask the view manager to draw the planes:
self._view_manager.drawPlanes(self._event_manager)
self._view_manager.drawOpDetWvf(self._event_manager)


self.setGeometry(0, 0, 2400/2, 1600/2)
Expand Down
31 changes: 22 additions & 9 deletions UserDev/EventDisplay/python/gui/optical_elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
_bordercol_ = {
'pmt_coated' : (255,255,255,255),
'pmt_uncoated' : (0,0,255,255),
'arapuca_vuv' : (34,139,34),
'arapuca_vis' : (34,139,34),
'xarapuca_vuv' : (34,139,34),
'xarapuca_vis' : (34,139,34),
}
Expand All @@ -20,9 +22,10 @@ def __init__(self, geom, tpc=0, pmtscale=None):
self._tpc = tpc
self._pmtscale = pmtscale

self._names = ['pmt_coated', 'pmt_uncoated']
self._size = 10
self._symbol = 'o'
# self._names = ['pmt_coated', 'pmt_uncoated']
# self._size = 10
# self._symbol = 'o'
# self._line_width = 2

self._start_time = 0
self._end_time = 10
Expand Down Expand Up @@ -60,14 +63,16 @@ def get_opdet_circles(self, pe=None, max_pe=None):
if pe is not None:
brush = self._pmtscale.colorMap().map(pe[d]/max_pe)

# print(f'OpCh{d}: [{opdets_x[d]}, {opdets_y[d]}, {opdets_z[d]}]')
# print(f'{self._names} OpCh{d}: [{opdets_x[d]}, {opdets_y[d]}, {opdets_z[d]}]')

self._opdet_circles.append({'pos' : (opdets_z[d], opdets_y[d]),
'size' : self._size,
'pen' : {'color': _bordercol_[opdets_name[d]], 'width': 2},
'pen' : {'color': _bordercol_[opdets_name[d]],
'width': self._line_width},
'brush' : brush,
'symbol' : self._symbol,
'data' : {'id': d, 'highlight': False}})
'data' : {'id': d,
'highlight': False}})
self._opdets_name = opdets_name
self._opdets_x = opdets_x
self._opdets_y = opdets_y
Expand Down Expand Up @@ -161,11 +166,17 @@ def show_raw_data(self, data):
ch = element['data']['id']
data_y = self._data[ch]

if len(data_y) == 0:
continue

# Remove the dafault values from the entries to be plotted
default_value_indexes = np.where(data_y == self._geom.opdetDefaultValue())
data_y = np.delete(data_y, default_value_indexes)

amplitude = data_y.max() - data_y.min()
try:
amplitude = data_y.max() - data_y.min()
except:
continue

pe_per_opdet[ch] = amplitude

Expand All @@ -186,8 +197,9 @@ class Pmts(OpticalElements):
def __init__(self, geom, tpc=0, pmtscale=None):

self._names = ['pmt_coated', 'pmt_uncoated']
self._size = 6
self._size = 10
self._symbol = 'o'
self._line_width = 2
super(Pmts, self).__init__(geom, tpc, pmtscale)


Expand All @@ -198,7 +210,8 @@ class Arapucas(OpticalElements):
'''
def __init__(self, geom, tpc=0, pmtscale=None):

self._names = ['pmt_coated', 'pmt_uncoated']
self._names = ['xarapuca_vuv', 'xarapuca_vis', 'arapuca_vuv', 'arapuca_vis']
self._size = 6
self._symbol = 's'
self._line_width = 1
super(Arapucas, self).__init__(geom, tpc, pmtscale)
37 changes: 19 additions & 18 deletions UserDev/EventDisplay/python/gui/opticalviewport.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import math

from .qrangeslider import QRangeSlider
from .optical_elements import Pmts, Arapucas
from .optical_elements import Pmts, Arapucas, _bordercol_

class opticalviewport(QtGui.QWidget):
def __init__(self, geometry, plane=-1):
Expand Down Expand Up @@ -34,7 +34,7 @@ def __init__(self, geometry, plane=-1):

self._flash_time_view = flash_time_view(self._geometry)
self._totalLayout.addWidget(self._flash_time_view)
self._time_window = pg.LinearRegionItem(values=[0,10], orientation=pg.LinearRegionItem.Vertical)
self._time_window = pg.LinearRegionItem(values=[0,10], orientation=pg.LinearRegionItem.Vertical)
self._time_window.sigRegionChangeFinished.connect(self.time_range_worker)
self._flash_time_view.connectTimeWindow(self._time_window)
for p in self._pmts:
Expand Down Expand Up @@ -175,7 +175,7 @@ def init_opdet_ui(self):
these_pmts.sigClicked.connect(self.pmtClickWorker)
these_pmts.scene().sigMouseMoved.connect(these_pmts.onMove)

these_arapucas = Arapucas(self._geometry, tpc=tpc)
these_arapucas = Arapucas(self._geometry, tpc=tpc, pmtscale=this_scale)
opdet_plot.addItem(these_arapucas)
these_arapucas.sigClicked.connect(self.arapucaClickWorker)
these_arapucas.scene().sigMouseMoved.connect(these_arapucas.onMove)
Expand All @@ -190,8 +190,9 @@ def drawOpDetWvf(self, data):
self._wf_view.drawOpDetWvf(data)

if self._show_raw:
for p in self._pmts:
for p, a in zip(self._pmts, self._arapucas):
p.show_raw_data(data)
a.show_raw_data(data)


def setFlashesForPlane(self, p, flashes):
Expand Down Expand Up @@ -245,9 +246,9 @@ def pmtClickWorker(self, plot, points):

def arapucaClickWorker(self, plot, points):
for p in self._last_clicked_arapucas:
p.setPen('g', width=2)
p.setPen(_bordercol_['arapuca_vuv'], width=1)
for p in points:
p.setPen('r', width=4)
p.setPen('g', width=2)
self._selected_ch = p.data()['id']

self._last_clicked_arapucas = points
Expand Down Expand Up @@ -306,21 +307,21 @@ def drawOpDetWvf(self, data, offset=100):

self._data = data

opdets_name = self._geometry.opdetName()
# opdets_name = self._geometry.opdetName()

data_x = np.linspace(-1250, 2500, len(data[0]))
# data_x = np.linspace(-1250, 2500, len(data[0]))

counter = 0
for ch in range(0, len(opdets_name)):
name = opdets_name[ch]
# counter = 0
# for ch in range(0, len(opdets_name)):
# name = opdets_name[ch]

if name == 'pmt':
data_y = data[ch]
data_y = data_y + counter * offset
# self._wf_plot.plot(x=data_x, y=data_y)
counter += 1
if counter > 7:
break
# if name == 'pmt':
# data_y = data[ch]
# data_y = data_y + counter * offset
# # self._wf_plot.plot(x=data_x, y=data_y)
# counter += 1
# if counter > 7:
# break

self._wf_plot.autoRange()

Expand Down

0 comments on commit ecc5560

Please sign in to comment.