Skip to content

Commit

Permalink
Parameters for clustering
Browse files Browse the repository at this point in the history
  • Loading branch information
yger committed Jan 29, 2025
1 parent 33b2e79 commit cd8da11
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
18 changes: 7 additions & 11 deletions src/spikeinterface/sortingcomponents/clustering/circus.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class CircusClustering:
"hdbscan_kwargs": {
"min_cluster_size": 20,
"min_samples": 1,
# "cluster_selection_epsilon": 0.1,
"cluster_selection_method": "eom",
"allow_single_cluster": True,
"core_dist_n_jobs": 1,
Expand All @@ -57,6 +56,8 @@ class CircusClustering:
"recursive_depth": 3,
"returns_split_count": True,
},
"split_kwargs": {"projection_mode" : "tsvd",
"percentile_variance_explained" : 95},
"radius_um": 100,
"n_svd": 5,
"few_waveforms": None,
Expand Down Expand Up @@ -215,7 +216,10 @@ def main_function(cls, recording, peaks, params, job_kwargs=dict()):
original_labels = peaks["channel_index"]
from spikeinterface.sortingcomponents.clustering.split import split_clusters

min_size = 2 * params["hdbscan_kwargs"].get("min_cluster_size", 20)
split_kwargs = params["split_kwargs"].copy()
split_kwargs["neighbours_mask"] = neighbours_mask
split_kwargs["waveforms_sparse_mask"] = sparse_mask
split_kwargs["min_size_split"] = 2 * params["hdbscan_kwargs"].get("min_cluster_size", 20)

if params["debug"]:
debug_folder = tmp_folder / "split"
Expand All @@ -227,15 +231,7 @@ def main_function(cls, recording, peaks, params, job_kwargs=dict()):
recording,
features_folder,
method="local_feature_clustering",
method_kwargs=dict(
clusterer="hdbscan",
feature_name="sparse_tsvd",
neighbours_mask=neighbours_mask,
waveforms_sparse_mask=sparse_mask,
min_size_split=min_size,
clusterer_kwargs=d["hdbscan_kwargs"],
n_pca_features=2,
),
method_kwargs=split_kwargs,
debug_folder=debug_folder,
**params["recursive_kwargs"],
**job_kwargs,
Expand Down
2 changes: 1 addition & 1 deletion src/spikeinterface/sortingcomponents/clustering/split.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def split(
n_pca_features=2,
minimum_overlap_ratio=0.25,
projection_mode="pca",
percentile_variance_explained=95,
percentile_variance_explained=None,
):
local_labels = np.zeros(peak_indices.size, dtype=np.int64)

Expand Down

0 comments on commit cd8da11

Please sign in to comment.