Skip to content

Iterative Isosplit doesn't work with SpykingCircus2 #4604

@b-grimaud

Description

@b-grimaud

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions