diff --git a/amstrax/plugins/events/events.py b/amstrax/plugins/events/events.py index 251aac67..16e3554a 100644 --- a/amstrax/plugins/events/events.py +++ b/amstrax/plugins/events/events.py @@ -34,7 +34,7 @@ def get_window_size(self): return (2 * self.config['left_event_extension'] + self.config['right_event_extension']) - def compute(self, peaks): + def compute(self, peaks, start, end): le = self.config['left_event_extension'] re = self.config['right_event_extension'] @@ -52,6 +52,12 @@ def compute(self, peaks): left_extension=le, right_extension=re) + # Don't extend beyond the chunk boundaries + # This will often happen for events near the invalid boundary of the + # overlap processing (which should be thrown away) + t0 = np.clip(t0, start, end) + t1 = np.clip(t1, start, end) + result = np.zeros(len(t0), self.dtype) result['time'] = t0 result['endtime'] = t1