Skip to content

Commit

Permalink
Merge pull request SpikeInterface#2874 from h-mayorquin/remove_extrac…
Browse files Browse the repository at this point in the history
…tor_name

Remove unused extractor attribute `extractor_name`
  • Loading branch information
alejoe91 authored Jul 3, 2024
2 parents b7db51f + e1aa960 commit 9513be4
Show file tree
Hide file tree
Showing 32 changed files with 8 additions and 45 deletions.
2 changes: 1 addition & 1 deletion src/spikeinterface/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ def save_to_folder(
Parameters
----------
name : str , optional
name : str or Path, optional
The name of the subfolder within the global temporary folder. If `folder`
is provided, this argument must be None.
folder : str or Path, optional
Expand Down
11 changes: 7 additions & 4 deletions src/spikeinterface/core/baserecording.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ def __init__(self, sampling_frequency: float, channel_ids: list, dtype):
self.annotate(is_filtered=False)

def __repr__(self):
extractor_name = self.__class__.__name__

class_name = self.__class__.__name__
name_to_display = class_name
num_segments = self.get_num_segments()

txt = self._repr_header()
Expand All @@ -55,7 +57,7 @@ def __repr__(self):
split_index = txt.rfind("-", 0, 100) # Find the last "-" before character 100
if split_index != -1:
first_line = txt[:split_index]
recording_string_space = len(extractor_name) + 2 # Length of extractor_name plus ": "
recording_string_space = len(name_to_display) + 2 # Length of name_to_display plus ": "
white_space_to_align_with_first_line = " " * recording_string_space
second_line = white_space_to_align_with_first_line + txt[split_index + 1 :].lstrip()
txt = first_line + "\n" + second_line
Expand Down Expand Up @@ -95,7 +97,8 @@ def list_to_string(lst, max_size=6):
return txt

def _repr_header(self):
extractor_name = self.__class__.__name__
class_name = self.__class__.__name__
name_to_display = class_name
num_segments = self.get_num_segments()
num_channels = self.get_num_channels()
sf_khz = self.get_sampling_frequency() / 1000.0
Expand All @@ -106,7 +109,7 @@ def _repr_header(self):
total_memory_size = self.get_total_memory_size()

txt = (
f"{extractor_name}: "
f"{name_to_display}: "
f"{num_channels} channels - "
f"{sf_khz:0.1f}kHz - "
f"{num_segments} segments - "
Expand Down
1 change: 0 additions & 1 deletion src/spikeinterface/core/binaryfolder.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class BinaryFolderRecording(BinaryRecordingExtractor):
The recording
"""

extractor_name = "BinaryFolder"
mode = "folder"
name = "binaryfolder"

Expand Down
1 change: 0 additions & 1 deletion src/spikeinterface/core/binaryrecordingextractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class BinaryRecordingExtractor(BaseRecording):
The recording Extractor
"""

extractor_name = "BinaryRecording"
mode = "file"
name = "binary"

Expand Down
1 change: 0 additions & 1 deletion src/spikeinterface/core/npyfoldersnippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class NpyFolderSnippets(NpySnippetsExtractor):
The snippets
"""

extractor_name = "NpyFolderSnippets"
mode = "folder"
name = "npyfolder"

Expand Down
1 change: 0 additions & 1 deletion src/spikeinterface/core/npysnippetsextractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class NpySnippetsExtractor(BaseSnippets):
All spike are store in two columns maner index+labels
"""

extractor_name = "NpySnippets"
mode = "file"
name = "npy"

Expand Down
1 change: 0 additions & 1 deletion src/spikeinterface/core/npzsortingextractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class NpzSortingExtractor(BaseSorting):
All spike are store in two columns maner index+labels
"""

extractor_name = "NpzSortingExtractor"
mode = "file"
name = "npz"

Expand Down
2 changes: 0 additions & 2 deletions src/spikeinterface/core/numpyextractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class NumpyRecording(BaseRecording):
An optional list of channel_ids. If None, linear channels are assumed
"""

extractor_name = "Numpy"
mode = "memory"
name = "numpy"

Expand Down Expand Up @@ -143,7 +142,6 @@ class SharedMemoryRecording(BaseRecording):
If True, the main instance will unlink the sharedmem buffer when deleted
"""

extractor_name = "SharedMemory"
mode = "memory"
name = "SharedMemory"

Expand Down
2 changes: 0 additions & 2 deletions src/spikeinterface/core/old_api_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ class NewToOldSorting:
* unique segment
"""

extractor_name = "NewToOldSorting"

def __init__(self, sorting):
assert sorting.get_num_segments() == 1
self._sorting = sorting
Expand Down
2 changes: 0 additions & 2 deletions src/spikeinterface/core/sortingfolder.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class NumpyFolderSorting(BaseSorting):
"""

extractor_name = "NumpyFolderSorting"
mode = "folder"
name = "NumpyFolder"

Expand Down Expand Up @@ -91,7 +90,6 @@ class NpzFolderSorting(NpzSortingExtractor):
The sorting
"""

extractor_name = "NpzFolder"
mode = "folder"
name = "npzfolder"

Expand Down
2 changes: 0 additions & 2 deletions src/spikeinterface/core/zarrextractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class ZarrRecordingExtractor(BaseRecording):
The recording Extractor
"""

extractor_name = "ZarrRecording"
installed = True
mode = "folder"
installation_mesg = ""
Expand Down Expand Up @@ -168,7 +167,6 @@ class ZarrSortingExtractor(BaseSorting):
The sorting Extractor
"""

extractor_name = "ZarrSorting"
installed = True
mode = "folder"
installation_mesg = ""
Expand Down
1 change: 0 additions & 1 deletion src/spikeinterface/extractors/alfsortingextractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class ALFSortingExtractor(BaseSorting):
The loaded data.
"""

extractor_name = "ALFSorting"
installation_mesg = "To use the ALF extractors, install ONE-api: \n\n pip install ONE-api\n\n"
name = "alf"

Expand Down
1 change: 0 additions & 1 deletion src/spikeinterface/extractors/cbin_ibl.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class CompressedBinaryIblExtractor(BaseRecording):
The loaded data.
"""

extractor_name = "CompressedBinaryIbl"
mode = "folder"
installation_mesg = "To use the CompressedBinaryIblExtractor, install mtscomp: \n\n pip install mtscomp\n\n"
name = "cbin_ibl"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class CellExplorerSortingExtractor(BaseSorting):
Path to the `sessionInfo.mat` file. If None, it will be inferred from the file_path.
"""

extractor_name = "CellExplorerSortingExtractor"
mode = "file"
installation_mesg = "To use the CellExplorerSortingExtractor install pymatreader"

Expand Down
1 change: 0 additions & 1 deletion src/spikeinterface/extractors/combinatoextractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class CombinatoSortingExtractor(BaseSorting):
The loaded data.
"""

extractor_name = "CombinatoSortingExtractor"
installed = HAVE_H5PY
installation_mesg = "To use the CombinatoSortingExtractor install h5py: \n\n pip install h5py\n\n"
name = "combinato"
Expand Down
1 change: 0 additions & 1 deletion src/spikeinterface/extractors/hdsortextractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class HDSortSortingExtractor(MatlabHelper, BaseSorting):
The loaded data.
"""

extractor_name = "HDSortSortingExtractor"
mode = "file"
name = "hdsort"

Expand Down
1 change: 0 additions & 1 deletion src/spikeinterface/extractors/herdingspikesextractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class HerdingspikesSortingExtractor(BaseSorting):
The loaded data.
"""

extractor_name = "HS2Sorting"
installed = HAVE_HS2SX # check at class level if installed or not
mode = "file"
installation_mesg = (
Expand Down
2 changes: 0 additions & 2 deletions src/spikeinterface/extractors/iblextractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class IblRecordingExtractor(BaseRecording):
The recording extractor which allows access to the traces.
"""

extractor_name = "IblRecording"
mode = "folder"
installation_mesg = "To use the IblRecordingSegment, install ibllib: \n\n pip install ONE-api\npip install ibllib\n"
name = "ibl_recording"
Expand Down Expand Up @@ -305,7 +304,6 @@ class IblSortingExtractor(BaseSorting):
The loaded data.
"""

extractor_name = "IBLSorting"
name = "ibl"
installation_mesg = "IBL extractors require ibllib as a dependency." " To install, run: \n\n pip install ibllib\n\n"

Expand Down
1 change: 0 additions & 1 deletion src/spikeinterface/extractors/klustaextractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class KlustaSortingExtractor(BaseSorting):
The loaded data.
"""

extractor_name = "KlustaSortingExtractor"
installed = HAVE_H5PY # check at class level if installed or not
installation_mesg = (
"To use the KlustaSortingExtractor install h5py: \n\n pip install h5py\n\n" # error message when not installed
Expand Down
1 change: 0 additions & 1 deletion src/spikeinterface/extractors/matlabhelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class MatlabHelper:
extractor_name = "MATSortingExtractor"
mode = "file"
installation_mesg = (
"To use the MATSortingExtractor install h5py and scipy: " "\n\n pip install h5py scipy\n\n"
Expand Down
1 change: 0 additions & 1 deletion src/spikeinterface/extractors/mclustextractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class MClustSortingExtractor(BaseSorting):
Loaded data.
"""

extractor_name = "MClustSortingExtractor"
name = "mclust"

def __init__(self, folder_path, sampling_frequency, sampling_frequency_raw=None):
Expand Down
1 change: 0 additions & 1 deletion src/spikeinterface/extractors/mcsh5extractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class MCSH5RecordingExtractor(BaseRecording):
The loaded data.
"""

extractor_name = "MCSH5Recording"
mode = "file"
installation_mesg = (
"To use the MCSH5RecordingExtractor install h5py: \n\n pip install h5py\n\n" # error message when not installed
Expand Down
2 changes: 0 additions & 2 deletions src/spikeinterface/extractors/mdaextractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class MdaRecordingExtractor(BaseRecording):
The loaded data.
"""

extractor_name = "MdaRecording"
mode = "folder"
name = "mda"

Expand Down Expand Up @@ -193,7 +192,6 @@ class MdaSortingExtractor(BaseSorting):
The loaded data.
"""

extractor_name = "MdaSorting"
mode = "file"
name = "mda"

Expand Down
1 change: 0 additions & 1 deletion src/spikeinterface/extractors/neoextractors/neuroscope.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ class NeuroScopeSortingExtractor(BaseSorting):
Path to the .xml file referenced by this sorting.
"""

extractor_name = "NeuroscopeSortingExtractor"
name = "neuroscope"

def __init__(
Expand Down
2 changes: 0 additions & 2 deletions src/spikeinterface/extractors/nwbextractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,6 @@ class NwbRecordingExtractor(BaseRecording):
>>> rec = NwbRecordingExtractor(s3_url, stream_mode="fsspec", stream_cache_path="cache")
"""

extractor_name = "NwbRecording"
mode = "file"
name = "nwb"
installation_mesg = "To use the Nwb extractors, install pynwb: \n\n pip install pynwb\n\n"
Expand Down Expand Up @@ -1001,7 +1000,6 @@ class NwbSortingExtractor(BaseSorting):
The sorting extractor for the NWB file.
"""

extractor_name = "NwbSorting"
mode = "file"
installation_mesg = "To use the Nwb extractors, install pynwb: \n\n pip install pynwb\n\n"
name = "nwb"
Expand Down
3 changes: 0 additions & 3 deletions src/spikeinterface/extractors/phykilosortextractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class BasePhyKilosortSortingExtractor(BaseSorting):
If True, all cluster properties are loaded from the tsv/csv files.
"""

extractor_name = "BasePhyKilosortSorting"
installed = False # check at class level if installed or not
mode = "folder"
installation_mesg = (
Expand Down Expand Up @@ -229,7 +228,6 @@ class PhySortingExtractor(BasePhyKilosortSortingExtractor):
The loaded Sorting object.
"""

extractor_name = "PhySorting"
name = "phy"

def __init__(
Expand Down Expand Up @@ -271,7 +269,6 @@ class KiloSortSortingExtractor(BasePhyKilosortSortingExtractor):
The loaded Sorting object.
"""

extractor_name = "KiloSortSorting"
name = "kilosort"

def __init__(self, folder_path: Path | str, keep_good_only: bool = False, remove_empty_units: bool = True):
Expand Down
2 changes: 0 additions & 2 deletions src/spikeinterface/extractors/shybridextractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class SHYBRIDRecordingExtractor(BinaryRecordingExtractor):
Loaded data.
"""

extractor_name = "SHYBRIDRecording"
mode = "folder"
installation_mesg = (
"To use the SHYBRID extractors, install SHYBRID and pyyaml: " "\n\n pip install shybrid pyyaml\n\n"
Expand Down Expand Up @@ -159,7 +158,6 @@ class SHYBRIDSortingExtractor(BaseSorting):
Loaded data.
"""

extractor_name = "SHYBRIDSorting"
installation_mesg = "To use the SHYBRID extractors, install SHYBRID: \n\n pip install shybrid\n\n"
name = "shybrid"

Expand Down
1 change: 0 additions & 1 deletion src/spikeinterface/extractors/spykingcircusextractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class SpykingCircusSortingExtractor(BaseSorting):
Loaded data.
"""

extractor_name = "SpykingCircusSortingExtractor"
installed = HAVE_H5PY # check at class level if installed or not
mode = "folder"
installation_mesg = "To use the SpykingCircusSortingExtractor install h5py: \n\n pip install h5py\n\n"
Expand Down
1 change: 0 additions & 1 deletion src/spikeinterface/extractors/tridesclousextractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class TridesclousSortingExtractor(BaseSorting):
Loaded data.
"""

extractor_name = "TridesclousSortingExtractor"
mode = "folder"
installation_mesg = "To use the TridesclousSortingExtractor install tridesclous: \n\n pip install tridesclous\n\n" # error message when not installed
name = "tridesclous"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@


class WaveClusSnippetsExtractor(MatlabHelper, BaseSnippets):
extractor_name = "WaveClusSnippetsExtractor"
name = "waveclus"

def __init__(self, file_path):
Expand Down
1 change: 0 additions & 1 deletion src/spikeinterface/extractors/waveclustextractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class WaveClusSortingExtractor(MatlabHelper, BaseSorting):
Loaded data.
"""

extractor_name = "WaveClusSortingExtractor"
name = "waveclus"

def __init__(self, file_path, keep_good_only=True):
Expand Down
1 change: 0 additions & 1 deletion src/spikeinterface/extractors/yassextractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class YassSortingExtractor(BaseSorting):
Loaded data.
"""

extractor_name = "YassExtractor"
mode = "folder"
installed = HAVE_YAML # check at class level if installed or not
installation_mesg = (
Expand Down

0 comments on commit 9513be4

Please sign in to comment.