Repository navigation
Handle edge frames in concatenated rec - #1883
Conversation
h-mayorquin
left a comment
There was a problem hiding this comment.
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.
| # # 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) | ||
|
|
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Fair enough but this case is not tested for in any of the other extractors currently (including Neo based I believe)
There was a problem hiding this comment.
I think we should follow numpy semantics for slicing and I checked this is consistent with it.
Fixes #1881