From a61965bdf7a9b34cedc0633ec40106021032c33a Mon Sep 17 00:00:00 2001 From: Samuel Watkins <35979561+slwatkins@users.noreply.github.com> Date: Fri, 1 Nov 2024 11:14:09 -0700 Subject: [PATCH] fix negative pulse triggering --- src/splendaq/daq/_offline_trigger.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/splendaq/daq/_offline_trigger.py b/src/splendaq/daq/_offline_trigger.py index 3c6870d..eb05d63 100644 --- a/src/splendaq/daq/_offline_trigger.py +++ b/src/splendaq/daq/_offline_trigger.py @@ -518,20 +518,18 @@ def acquire_pulses(self, template, psd, threshold_on, tchan, threshold_off=None, for kk, filt in enumerate(filtered): - if posthreshold: - ranges = EventBuilder._smart_trigger( - filt, self._threshold_on, self._threshold_off, mergewindow, - ) - else: - ranges = EventBuilder._smart_trigger( - -filt, -self._threshold_on, -self._threshold_off, mergewindow, - ) + ranges = EventBuilder._smart_trigger( + sign * filt, + sign * self._threshold_on, + sign * self._threshold_off, + mergewindow, + ) if len(ranges)==0: break for ind0, ind1 in zip(ranges[:, 0], ranges[:, 1]): - indmax = ind0 + np.argmax(filt[ind0:ind1]) + indmax = ind0 + np.argmax(sign * filt[ind0:ind1]) evtinds_list.append([indmax - self._tracelength//2]) triginds_list.append([indmax]) evtamps_list.append([filt[indmax]])