SpikeInterface / SpikeInterface/spikeinterface
Iterative Isosplit doesn't work with SpykingCircus2
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 847
- Forks
- 280
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 29
Description
I'm experimenting with clustering params and methods to reduce the number of contaminated units in my data, and I tried using iterative-isosplit instead of iterative-hdbscan with SC2 to see if results were noticeably different.
Here's the trace :
Traceback (most recent call last):
File "/home/user/Documents/ephy/pipelines/spike_sorting.py", line 253, in <module>
run_spike_sorting(path, sorter, preprocessing, sorter_params, extensions=True)
File "/home/user/Documents/ephy/pipelines/spike_sorting.py", line 86, in run_spike_sorting
sorting = ss.run_sorter(
^^^^^^^^^^^^^^
File "/home/user/Documents/GitHub/spikeinterface/src/spikeinterface/sorters/runsorter.py", line 206, in run_sorter
return run_sorter_local(**common_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/Documents/GitHub/spikeinterface/src/spikeinterface/sorters/runsorter.py", line 298, in run_sorter_local
SorterClass.run_from_folder(folder, raise_error, verbose)
File "/home/user/Documents/GitHub/spikeinterface/src/spikeinterface/sorters/basesorter.py", line 306, in run_from_folder
raise SpikeSortingError(
spikeinterface.sorters.utils.misc.SpikeSortingError: Spike sorting error trace:
Traceback (most recent call last):
File "/home/user/Documents/GitHub/spikeinterface/src/spikeinterface/sorters/basesorter.py", line 266, in run_from_folder
SorterClass._run_from_folder(sorter_output_folder, sorter_params, verbose)
File "/home/user/Documents/GitHub/spikeinterface/src/spikeinterface/sorters/internal/spyking_circus2.py", line 408, in _run_from_folder
cleaning_kwargs["max_std_per_channel"] = max_std_per_channel
^^^^^^^^^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'max_std_per_channel' where it is not associated with a value
Spike sorting failed. You can inspect the runtime trace in /home/user/HDMEA_Data/To_be_analyzed/2085/20260602_133942_spykingcircus2_260126-2085-06_03_raw_00/spykingcircus2_output/spikeinterface_log.json.
From a quick look, it seems that find_clusters_from_peaks returns a dict in more_outs with templates and time_shifts as keys, but nothing SVD-related. This sets clustering_from_svd as False, and thus templates are obtained from get_templates_from_peaks_and_recording and not get_templates_from_peaks_and_svd. The latter also returns max_std_per_channel, but the former doesn't, which results in a crash at cleaning_kwargs["max_std_per_channel"] = max_std_per_channel.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in spikeinterface/sorters/internal/spyking_circus2.py at _run_from_folder, then inspect find_clusters_from_peaks, get_templates_from_peaks_and_recording, and get_templates_from_peaks_and_svd. Reproduce the iterative-isosplit path with SpykingCircus2 and compare the returned values. Done means the sorting run completes without the reported UnboundLocalError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100