Skip to content

Handle edge frames in concatenated rec - #1883

Merged
alejoe91 merged 1 commit into
SpikeInterface:mainfrom
CSC-UW:concat_rec_end_frame
Jul 27, 2023
Merged

alejoe91 merged 1 commit into
SpikeInterface:mainfrom
CSC-UW:concat_rec_end_frame

Conversation

@TomBugnon

@TomBugnon TomBugnon commented Jul 26, 2023 •

Copy link
Copy Markdown
Contributor

Fixes #1881

@h-mayorquin h-mayorquin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is fine as a patch. Thanks for spotting this, @TomBugnon.

If the maintenace push ever comes to be, we should have a generalized test for boundary conditions, array-like behavior and channel_indices behavior for recording, pre-processing and segment utils. Something like what we have for the neo extractors.

@alejoe91 alejoe91 added bug Something isn't working core Changes to core module labels Jul 27, 2023
@alejoe91
alejoe91 merged commit dd37a74 into SpikeInterface:main Jul 27, 2023
@TomBugnon
TomBugnon deleted the concat_rec_end_frame branch July 27, 2023 16:12
Comment on lines +172 to +176
# # Ensures that we won't request invalid segment indices
if (start_frame >= self.get_num_samples()) or (end_frame <= start_frame):
# Return (0 * num_channels) array of correct dtype
return self.parent_segments[0].get_traces(0, 0, channel_indices)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why not raising an error ? start_frame should nver be >= num_samples.
Here we are hidding another and deeper bug.
Could we revert this make a test that trigger the bug and then make a concensus fix ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

1: Without this fix, when user calls get_traces with out-of-range start/end frames they get an error, which is inconsistent with the other extractors' behavior (which all return an empty array)

2: valid TracePadRecording.get_traces calls will under the hood call get_traces with start_frame==end_frame and
raise this error as int the issue I filed

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am not sure to be OK this kind of hidden patch for other extractor.
start_frame >= self.get_num_samples() should not be allowed in my mind.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fair enough but this case is not tested for in any of the other extractors currently (including Neo based I believe)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we should follow numpy semantics for slicing and I checked this is consistent with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working core Changes to core module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

get_traces(start_frame=num_samples, end_frame=num_samples) fails for ProxyConcatenateRecordingSegment

4 participants