From 5a3b2f83ce171777879dc3ec992be933928a14a9 Mon Sep 17 00:00:00 2001 From: Heberto Mayorquin Date: Wed, 19 Jun 2024 09:06:23 -0600 Subject: [PATCH 1/2] cell explorer deprecation --- .../cellexplorersortingextractor.py | 26 ++----------------- .../extractors/iblextractors.py | 20 +++++++------- 2 files changed, 11 insertions(+), 35 deletions(-) diff --git a/src/spikeinterface/extractors/cellexplorersortingextractor.py b/src/spikeinterface/extractors/cellexplorersortingextractor.py index 3436313b4d..9b77965c43 100644 --- a/src/spikeinterface/extractors/cellexplorersortingextractor.py +++ b/src/spikeinterface/extractors/cellexplorersortingextractor.py @@ -2,8 +2,7 @@ import numpy as np from pathlib import Path -import warnings -import datetime + from ..core import BaseSorting, BaseSortingSegment from ..core.core_tools import define_function_from_class @@ -36,36 +35,15 @@ class CellExplorerSortingExtractor(BaseSorting): def __init__( self, - file_path: str | Path | None = None, + file_path: str | Path, sampling_frequency: float | None = None, session_info_file_path: str | Path | None = None, - spikes_matfile_path: str | Path | None = None, ): try: from pymatreader import read_mat except ImportError: raise ImportError(self.installation_mesg) - assert ( - file_path is not None or spikes_matfile_path is not None - ), "Either file_path or spikes_matfile_path must be provided!" - - if spikes_matfile_path is not None: - # Raise an error if the warning period has expired - deprecation_issued = datetime.datetime(2023, 4, 1) - deprecation_deadline = deprecation_issued + datetime.timedelta(days=180) - if datetime.datetime.now() > deprecation_deadline: - raise ValueError("The spikes_matfile_path argument is no longer supported in. Use file_path instead.") - - # Otherwise, issue a DeprecationWarning - else: - warnings.warn( - "The spikes_matfile_path argument is deprecated and will be removed in six months. " - "Use file_path instead.", - DeprecationWarning, - ) - file_path = spikes_matfile_path if file_path is None else file_path - self.spikes_cellinfo_path = Path(file_path) self.session_path = self.spikes_cellinfo_path.parent self.session_id = self.spikes_cellinfo_path.stem.split(".")[0] diff --git a/src/spikeinterface/extractors/iblextractors.py b/src/spikeinterface/extractors/iblextractors.py index 6e3ee59cad..33e92d0aa5 100644 --- a/src/spikeinterface/extractors/iblextractors.py +++ b/src/spikeinterface/extractors/iblextractors.py @@ -314,18 +314,16 @@ class IblSortingExtractor(BaseSorting): installation_mesg = "IBL extractors require ibllib as a dependency." " To install, run: \n\n pip install ibllib\n\n" def __init__(self, pid, good_clusters_only=False, load_unit_properties=True, one=None): - try: - from one.api import ONE - from brainbox.io.one import SpikeSortingLoader + from one.api import ONE + from brainbox.io.one import SpikeSortingLoader + + if one is None: + one = {} + if isinstance(one, dict): + one = ONE(**one) + else: + one = IblRecordingExtractor._get_default_one() - if one is None: - one = {} - if isinstance(one, dict): - one = ONE(**one) - else: - one = IblRecordingExtractor._get_default_one() - except ImportError: - raise ImportError(self.installation_mesg) self.ssl = SpikeSortingLoader(one=one, pid=pid) sr = self.ssl.raw_electrophysiology(band="ap", stream=True) self._folder_path = self.ssl.session_path From f63e538685f38145f70dc9ef398f829538819d21 Mon Sep 17 00:00:00 2001 From: Heberto Mayorquin Date: Wed, 19 Jun 2024 09:11:54 -0600 Subject: [PATCH 2/2] restore ibl --- .../extractors/iblextractors.py | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/spikeinterface/extractors/iblextractors.py b/src/spikeinterface/extractors/iblextractors.py index 33e92d0aa5..6e3ee59cad 100644 --- a/src/spikeinterface/extractors/iblextractors.py +++ b/src/spikeinterface/extractors/iblextractors.py @@ -314,16 +314,18 @@ class IblSortingExtractor(BaseSorting): installation_mesg = "IBL extractors require ibllib as a dependency." " To install, run: \n\n pip install ibllib\n\n" def __init__(self, pid, good_clusters_only=False, load_unit_properties=True, one=None): - from one.api import ONE - from brainbox.io.one import SpikeSortingLoader - - if one is None: - one = {} - if isinstance(one, dict): - one = ONE(**one) - else: - one = IblRecordingExtractor._get_default_one() + try: + from one.api import ONE + from brainbox.io.one import SpikeSortingLoader + if one is None: + one = {} + if isinstance(one, dict): + one = ONE(**one) + else: + one = IblRecordingExtractor._get_default_one() + except ImportError: + raise ImportError(self.installation_mesg) self.ssl = SpikeSortingLoader(one=one, pid=pid) sr = self.ssl.raw_electrophysiology(band="ap", stream=True) self._folder_path = self.ssl.session_path