From d587a459520735b5bdba4fbb2e5f0b5b566364e0 Mon Sep 17 00:00:00 2001 From: Tom Bugnon Date: Wed, 26 Jul 2023 12:48:29 -0500 Subject: [PATCH] Force original_end_frame >= original_start_frame in tracepad --- src/spikeinterface/preprocessing/zero_channel_pad.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/spikeinterface/preprocessing/zero_channel_pad.py b/src/spikeinterface/preprocessing/zero_channel_pad.py index 124b2b080e..c3e1bc9ac7 100644 --- a/src/spikeinterface/preprocessing/zero_channel_pad.py +++ b/src/spikeinterface/preprocessing/zero_channel_pad.py @@ -119,6 +119,9 @@ def get_original_traces_shifted(self, start_frame, end_frame, channel_indices): """ original_start_frame = max(start_frame - self.padding_start, 0) original_end_frame = min(end_frame - self.padding_start, self.num_samples_in_original_segment) + original_end_frame = max( + original_end_frame, original_start_frame + ) # Avoid negative dimensions errors downstream original_traces = self.parent_recording_segment.get_traces( start_frame=original_start_frame, end_frame=original_end_frame,