Skip to content

Commit

Permalink
fix data starts early chunk
Browse files Browse the repository at this point in the history
  • Loading branch information
cfuselli committed Dec 11, 2023
1 parent 7be1bbc commit 0373c9a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion amstrax/plugins/events/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']

Expand All @@ -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
Expand Down

0 comments on commit 0373c9a

Please sign in to comment.