From 0e177c1955d2971c2328bc2fa45a228c7126b789 Mon Sep 17 00:00:00 2001 From: Heberto Mayorquin Date: Fri, 7 Jun 2024 10:00:00 -0600 Subject: [PATCH 1/2] overide select channels --- src/spikeinterface/core/baserecording.py | 2 +- src/spikeinterface/core/baserecordingsnippets.py | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/spikeinterface/core/baserecording.py b/src/spikeinterface/core/baserecording.py index 2fd14062ca..73bcc92463 100644 --- a/src/spikeinterface/core/baserecording.py +++ b/src/spikeinterface/core/baserecording.py @@ -605,7 +605,7 @@ def _extra_metadata_to_folder(self, folder): if time_vector is not None: np.save(folder / f"times_cached_seg{segment_index}.npy", time_vector) - def _select_channels(self, channel_ids: list | np.array | tuple) -> "BaseRecording": + def select_channels(self, channel_ids: list | np.array | tuple) -> "BaseRecording": """ Returns a new recording object with a subset of channels. diff --git a/src/spikeinterface/core/baserecordingsnippets.py b/src/spikeinterface/core/baserecordingsnippets.py index 1094e703a2..79057ef372 100644 --- a/src/spikeinterface/core/baserecordingsnippets.py +++ b/src/spikeinterface/core/baserecordingsnippets.py @@ -72,9 +72,6 @@ def is_filtered(self): # the is_filtered is handle with annotation return self._annotations.get("is_filtered", False) - def _select_channels(self, channel_ids: list | np.array | tuple) -> "BaseRecordingSnippets": - raise NotImplementedError - def _channel_slice(self, channel_ids, renamed_channel_ids=None): raise NotImplementedError @@ -478,7 +475,7 @@ def select_channels(self, channel_ids): BaseRecordingSnippets The object with sliced channels """ - return self._select_channels(channel_ids) + raise NotImplementedError def remove_channels(self, remove_channel_ids): """ From 819e2f6563888804257a82c25d2b8df232aa7c6c Mon Sep 17 00:00:00 2001 From: Heberto Mayorquin Date: Fri, 7 Jun 2024 10:11:35 -0600 Subject: [PATCH 2/2] missing sub-method --- src/spikeinterface/core/basesnippets.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/spikeinterface/core/basesnippets.py b/src/spikeinterface/core/basesnippets.py index f96bec3b51..4f6cbacd6d 100644 --- a/src/spikeinterface/core/basesnippets.py +++ b/src/spikeinterface/core/basesnippets.py @@ -135,13 +135,14 @@ def get_snippets_from_frames( def _save(self, format="binary", **save_kwargs): raise NotImplementedError - def _select_channels(self, channel_ids: list | np.array | tuple) -> "BaseSnippets": + def select_channels(self, channel_ids: list | np.array | tuple) -> "BaseSnippets": from .channelslice import ChannelSliceSnippets return ChannelSliceSnippets(self, channel_ids) def _channel_slice(self, channel_ids, renamed_channel_ids=None): from .channelslice import ChannelSliceSnippets + import warnings warnings.warn( "Snippets.channel_slice will be removed in version 0.103, use `select_channels` or `rename_channels` instead.",