Skip to content

Add archived sorters and change rt-sort to rtsort #4077

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions doc/modules/sorters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -472,24 +472,29 @@ Here is the list of external sorters accessible using the run_sorter wrapper:
* **Kilosort2.5** :code:`run_sorter(sorter_name='kilosort2_5')`
* **Kilosort3** :code:`run_sorter(sorter_name='kilosort3')`
* **PyKilosort** :code:`run_sorter(sorter_name='pykilosort')`
* **Klusta** :code:`run_sorter(sorter_name='klusta')`
* **Mountainsort4** :code:`run_sorter(sorter_name='mountainsort4')`
* **Mountainsort5** :code:`run_sorter(sorter_name='mountainsort5')`
* **RT-Sort** :code:`run_sorter(sorter_name='rt-sort')`
* **RTSort** :code:`run_sorter(sorter_name='rtsort')`
* **SpyKING Circus** :code:`run_sorter(sorter_name='spykingcircus')`
* **Tridesclous** :code:`run_sorter(sorter_name='tridesclous')`
* **Wave clus** :code:`run_sorter(sorter_name='waveclus')`
* **Combinato** :code:`run_sorter(sorter_name='combinato')`
* **HDSort** :code:`run_sorter(sorter_name='hdsort')`
* **YASS** :code:`run_sorter(sorter_name='yass')`


Here a list of internal sorter based on `spikeinterface.sortingcomponents`; they are totally
Here is a list of internal sorter based on `spikeinterface.sortingcomponents`; they are totally
experimental for now:

* **Spyking Circus2** :code:`run_sorter(sorter_name='spykingcircus2')`
* **Tridesclous2** :code:`run_sorter(sorter_name='tridesclous2')`


Here is the list of legacy sorters that are no longer supported, but can still be run
with an older version of SpikeInterface:

* **Klusta** :code:`run_sorter(sorter_name='klusta')`
* **YASS** :code:`run_sorter(sorter_name='yass')`


In 2024, we expect to add many more sorters to this list.


Expand Down
2 changes: 1 addition & 1 deletion doc/references.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ please include the appropriate citation for the :code:`sorter_name` parameter yo
- :code:`herdingspikes` [Muthmann]_ [Hilgen]_
- :code:`kilosort` [Pachitariu]_
- :code:`mountainsort` [Chung]_
- :code:`rt-sort` [van_der_Molen]_
- :code:`rtsort` [van_der_Molen]_
- :code:`spykingcircus` [Yger]_
- :code:`wavclus` [Chaure]_
- :code:`yass` [Lee]_
Expand Down
1 change: 0 additions & 1 deletion src/spikeinterface/sorters/container_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ def install_package_in_container(
if extra is not None:
cmd += f"{extra}"
res_output = container_client.run_command(cmd)

else:
raise ValueError(f"install_package_incontainer, wrong installation_mode={installation_mode}")

Expand Down
2 changes: 1 addition & 1 deletion src/spikeinterface/sorters/external/rt_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class RTSortSorter(BaseSorter):
"""RTSort sorter object"""

sorter_name = "rt-sort"
sorter_name = "rtsort"

_default_params = {
"detection_model": "neuropixels",
Expand Down
20 changes: 14 additions & 6 deletions src/spikeinterface/sorters/runsorter.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

from spikeinterface.core import BaseRecording, NumpySorting, load
from spikeinterface.core.core_tools import check_json, is_editable_mode
from .sorterlist import sorter_dict
from .utils import (
from spikeinterface.sorters.sorterlist import sorter_dict, archived_sorters
from spikeinterface.sorters.utils import (
SpikeSortingError,
has_nvidia,
has_docker,
Expand All @@ -28,7 +28,7 @@
has_spython,
has_docker_nvidia_installed,
)
from .container_tools import (
from spikeinterface.sorters.container_tools import (
find_recording_folders,
path_to_unix,
windows_extractor_dict_to_unix,
Expand All @@ -43,14 +43,14 @@
combinato="combinato",
herdingspikes="herdingspikes",
kilosort4="kilosort4",
klusta="klusta",
mountainsort4="mountainsort4",
mountainsort5="mountainsort5",
pykilosort="pykilosort",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pykilosort is only for < 3.10. I guess we are not there yet, but we are very close to needing to archive this. We should remember this.
https://github.com/MouseLand/pykilosort/blob/master/pyks2.yml

rtsort="rtsort",
spykingcircus="spyking-circus",
spykingcircus2="spyking-circus2",
tridesclous="tridesclous",
yass="yass",
tridesclous2="tridesclous2",
# Matlab compiled sorters:
hdsort="hdsort-compiled",
ironclust="ironclust-compiled",
Expand All @@ -60,6 +60,9 @@
kilosort3="kilosort3-compiled",
waveclus="waveclus-compiled",
waveclus_snippets="waveclus-compiled",
# archived
# klusta="klusta",
# yass="yass",
)

SORTER_DOCKER_MAP = {k: f"{REGISTRY}/{v}-base" for k, v in SORTER_DOCKER_MAP.items()}
Expand Down Expand Up @@ -127,6 +130,11 @@ def run_sorter(
--------
>>> sorting = run_sorter("tridesclous", recording)
"""
if sorter_name in archived_sorters():
raise ValueError(
f"The sorter {sorter_name} is archived and no longer supported. "
"Please use a different sorter or an older version of SpikeInterface."
)

common_kwargs = dict(
sorter_name=sorter_name,
Expand Down Expand Up @@ -547,7 +555,7 @@ def run_sorter_container(
res_output += str(container_client.run_command(cmd))
need_si_install = "ModuleNotFoundError" in res_output

if need_si_install:
if need_si_install or installation_mode == "dev":
# update pip in container
cmd = f"pip install --user --upgrade pip"
res_output = container_client.run_command(cmd)
Expand Down
9 changes: 8 additions & 1 deletion src/spikeinterface/sorters/sorterlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
Kilosort3Sorter,
Kilosort4Sorter,
PyKilosortSorter,
KlustaSorter,
Mountainsort4Sorter,
Mountainsort5Sorter,
RTSortSorter,
Expand All @@ -52,6 +51,8 @@
SimpleSorter,
]

# archived
archived_sorter_list = [KlustaSorter, YassSorter]

try:
# if the spikeinterface_kilosort_components source are installed on the machine
Expand All @@ -71,6 +72,12 @@ def available_sorters():
return sorted(list(sorter_dict.keys()))


def archived_sorters():
"""Lists archived sorters."""

return sorted([s.sorter_name for s in archived_sorter_list])


def installed_sorters():
"""Lists installed sorters."""

Expand Down
Loading