Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force original_end_frame >= original_start_frame in tracepad #1886

Closed
Closed
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
3 changes: 3 additions & 0 deletions src/spikeinterface/preprocessing/zero_channel_pad.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment on lines +122 to +124
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have the feelign that this is hidding a deeper bug.
How we could have this.
Would it be better to raise an error instead no ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's a real life scenario where original_end_frame < original_start_frame in TracePad

#1881 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I do think there is an unrelated bug in get_chunk_with_margins , tho): #1885 (comment)

original_traces = self.parent_recording_segment.get_traces(
start_frame=original_start_frame,
end_frame=original_end_frame,
Expand Down