diff --git a/src/spikeinterface/core/baserecording.py b/src/spikeinterface/core/baserecording.py index 73bcc92463..68a7dd744b 100644 --- a/src/spikeinterface/core/baserecording.py +++ b/src/spikeinterface/core/baserecording.py @@ -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) diff --git a/src/spikeinterface/core/baserecordingsnippets.py b/src/spikeinterface/core/baserecordingsnippets.py index 79057ef372..2a9f075954 100644 --- a/src/spikeinterface/core/baserecordingsnippets.py +++ b/src/spikeinterface/core/baserecordingsnippets.py @@ -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. @@ -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): """ diff --git a/src/spikeinterface/core/basesnippets.py b/src/spikeinterface/core/basesnippets.py index 4f6cbacd6d..1f3fee74a8 100644 --- a/src/spikeinterface/core/basesnippets.py +++ b/src/spikeinterface/core/basesnippets.py @@ -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