Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions PanGUI/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ def __init__(self, plotobjs, rows=None, cols=None, indexer=None,
else:
self.plotobjs = [plotobjs]
self.plotopts = [plotobj.plot(getPlotOpts=True) for plotobj in self.plotobjs]
self.preOpts = []

for plotopts in self.plotopts:
for (k, v) in kwargs.items():
if k in plotopts.keys():
Expand All @@ -44,6 +46,11 @@ def __init__(self, plotobjs, rows=None, cols=None, indexer=None,
else:
plotopts[k] = v

current_opt = None
if "PlotType" in plotopts:
current_opt = plotopts["PlotType"].selected()
self.preOpts += [current_opt]

self.currentIndex.setText(str(self.index))
fig1 = Figure()
fig1.set_facecolor((0.92, 0.92, 0.92))
Expand Down Expand Up @@ -218,7 +225,7 @@ def setplotopts(self, q):
if ii != idx:
self.plotobjs[ii].plot(self.index, ax=self.fig.axes[ii], **self.plotopts[ii])

numEvents, nidx = self.active_plotobj.plot(self.index, getNumEvents=True, **self.plotopts[idx])
numEvents, nidx = self.active_plotobj.plot(self.index, getNumEvents=True, preOpt=self.preOpts[idx], **self.plotopts[idx])
if numEvents != self.numEvents:
msg = QtWidgets.QMessageBox()
msg.setIcon(QtWidgets.QMessageBox.Warning)
Expand Down Expand Up @@ -315,8 +322,8 @@ def update_level(self, level):
# crazy high intial values so that the new value is always lower
num_events = 100_000
newIdx = 100_000
for (plotobj, plotopts) in zip(self.plotobjs, self.plotopts):
nn, _newIdx = plotobj.plot(self.index, getNumEvents=True, **plotopts)
for (i, plotobj) in enumerate(self.plotobjs):
nn, _newIdx = plotobj.plot(self.index, getNumEvents=True, preOpt=self.preOpts[i], **self.plotopts[i])
num_events = min(num_events, nn)
newIdx = min(newIdx, _newIdx)
self.numEvents = num_events
Expand Down