Skip to content

Commit

Permalink
Merge pull request #3001 from h-mayorquin/fix_frame_slice
Browse files Browse the repository at this point in the history
Add documentation to `frame_slice` in recording and drop redundant inheritance
  • Loading branch information
alejoe91 authored Jun 10, 2024
2 parents 530332d + a703a99 commit d962631
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
18 changes: 17 additions & 1 deletion src/spikeinterface/core/baserecording.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,23 @@ def _remove_channels(self, remove_channel_ids):
sub_recording = ChannelSliceRecording(self, new_channel_ids)
return sub_recording

def _frame_slice(self, start_frame, end_frame):
def frame_slice(self, start_frame: int, end_frame: int) -> BaseRecording:
"""
Returns a new recording with sliced frames. Note that this operation is not in place.
Parameters
----------
start_frame : int
The start frame
end_frame : int
The end frame
Returns
-------
BaseRecording
The object with sliced frames
"""

from .frameslicerecording import FrameSliceRecording

sub_recording = FrameSliceRecording(self, start_frame=start_frame, end_frame=end_frame)
Expand Down
5 changes: 1 addition & 4 deletions src/spikeinterface/core/baserecordingsnippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ def is_filtered(self):
def _channel_slice(self, channel_ids, renamed_channel_ids=None):
raise NotImplementedError

def _frame_slice(self, channel_ids, renamed_channel_ids=None):
raise NotImplementedError

def set_probe(self, probe, group_mode="by_probe", in_place=False):
"""
Attach a list of Probe object to a recording.
Expand Down Expand Up @@ -510,7 +507,7 @@ def frame_slice(self, start_frame, end_frame):
BaseRecordingSnippets
The object with sliced frames
"""
return self._frame_slice(start_frame, end_frame)
raise NotImplementedError

def select_segments(self, segment_indices):
"""
Expand Down
3 changes: 0 additions & 3 deletions src/spikeinterface/core/basesnippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,6 @@ def _remove_channels(self, remove_channel_ids):
sub_recording = ChannelSliceSnippets(self, new_channel_ids)
return sub_recording

def _frame_slice(self, start_frame, end_frame):
raise NotImplementedError

def _select_segments(self, segment_indices):
from .segmentutils import SelectSegmentSnippets

Expand Down

0 comments on commit d962631

Please sign in to comment.