Skip to content

Commit 46e40a1

Browse files
authored
Merge pull request #3944 from alejoe91/fix_kcoords_in_ks4
Fix kcoords for non-int groups
2 parents 1d6b366 + 6aa883b commit 46e40a1

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

.github/scripts/test_kilosort4_ci.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@
112112
PARAMS_TO_TEST_DICT.update({"cluster_neighbors": 11})
113113
PARAMETERS_NOT_AFFECTING_RESULTS.append("cluster_neighbors")
114114

115+
if parse(kilosort.__version__) >= parse("4.0.37"):
116+
PARAMS_TO_TEST_DICT.update({"max_cluster_subset": 20})
117+
PARAMETERS_NOT_AFFECTING_RESULTS.append("max_cluster_subset")
118+
115119

116120
PARAMS_TO_TEST = list(PARAMS_TO_TEST_DICT.keys())
117121

@@ -254,6 +258,8 @@ def test_initialize_ops_arguments(self):
254258
"device",
255259
"save_preprocessed_copy",
256260
]
261+
if parse(kilosort.__version__) >= parse("4.0.37"):
262+
expected_arguments += ["gui_mode"]
257263

258264
self._check_arguments(
259265
initialize_ops,

src/spikeinterface/sorters/external/kilosort4.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,9 @@ def _setup_json_probe_map(cls, recording, sorter_output_folder):
438438
chanMap = np.arange(n_chan)
439439
xc = positions[:, 0]
440440
yc = positions[:, 1]
441-
kcoords = groups.astype(float)
441+
unique_groups = set(groups)
442+
group_map = {group: idx for idx, group in enumerate(unique_groups)}
443+
kcoords = np.array([group_map[group] for group in groups], dtype=int)
442444

443445
probe = {
444446
"chanMap": chanMap,

0 commit comments

Comments
 (0)