diff --git a/src/spikeinterface/sorters/internal/tridesclous2.py b/src/spikeinterface/sorters/internal/tridesclous2.py index 909a2d1cb3..ca1dfa1854 100644 --- a/src/spikeinterface/sorters/internal/tridesclous2.py +++ b/src/spikeinterface/sorters/internal/tridesclous2.py @@ -196,6 +196,8 @@ def _run_from_folder(cls, sorter_output_folder, params, verbose): original_labels = peaks["channel_index"] + min_cluster_size = 50 + post_split_label, split_count = split_clusters( original_labels, recording, @@ -208,8 +210,8 @@ def _run_from_folder(cls, sorter_output_folder, params, verbose): # feature_name="sparse_wfs", neighbours_mask=neighbours_mask, waveforms_sparse_mask=sparse_mask, - min_size_split=50, - min_cluster_size=50, + min_size_split=min_cluster_size, + min_cluster_size=min_cluster_size, min_samples=50, n_pca_features=3, ), @@ -240,9 +242,10 @@ def _run_from_folder(cls, sorter_output_folder, params, verbose): # criteria="percentile", # threshold_percentile=80., criteria="distrib_overlap", - threshold_overlap=0.4, + threshold_overlap=0.3, + min_cluster_size=min_cluster_size+1, # num_shift=0 - num_shift=2, + num_shift=5, ), **job_kwargs, ) diff --git a/src/spikeinterface/sortingcomponents/clustering/merge.py b/src/spikeinterface/sortingcomponents/clustering/merge.py index d892d0723a..45090452dc 100644 --- a/src/spikeinterface/sortingcomponents/clustering/merge.py +++ b/src/spikeinterface/sortingcomponents/clustering/merge.py @@ -398,6 +398,7 @@ def merge( threshold_diptest=0.5, threshold_percentile=80.0, threshold_overlap=0.4, + min_cluster_size=50, num_shift=2, ): if num_shift > 0: @@ -414,7 +415,7 @@ def merge( chans1 = np.unique(peaks["channel_index"][inds1]) target_chans1 = np.flatnonzero(np.all(waveforms_sparse_mask[chans1, :], axis=0)) - if inds0.size < 40 or inds1.size < 40: + if inds0.size < min_cluster_size or inds1.size < min_cluster_size: is_merge = False merge_value = 0 final_shift = 0 @@ -525,7 +526,9 @@ def merge( # DEBUG = True DEBUG = False - if DEBUG and is_merge: + # if DEBUG and is_merge: + # if DEBUG and (overlap > 0.1 and overlap <0.3): + if DEBUG: # if DEBUG and not is_merge: # if DEBUG and (overlap > 0.05 and overlap <0.25): # if label0 == 49 and label1== 65: