Skip to content

Commit 0deac03

Browse files
committed
Small fixes in curation format and apply_curation()
1 parent a64aed9 commit 0deac03

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/spikeinterface/curation/curation_format.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,16 @@ def validate_curation_dict(curation_dict):
4545
if not removed_units_set.issubset(unit_set):
4646
raise ValueError("Curation format: some removed units are not in the unit list")
4747

48+
for group in curation_dict["merge_unit_groups"]:
49+
if len(group) < 2:
50+
raise ValueError("Curation format: 'merge_unit_groups' must be list of list with at least 2 elements")
51+
4852
all_merging_groups = [set(group) for group in curation_dict["merge_unit_groups"]]
4953
for gp_1, gp_2 in combinations(all_merging_groups, 2):
5054
if len(gp_1.intersection(gp_2)) != 0:
51-
raise ValueError("Some units belong to multiple merge groups")
55+
raise ValueError("Curation format: some units belong to multiple merge groups")
5256
if len(removed_units_set.intersection(merged_units_set)) != 0:
53-
raise ValueError("Some units were merged and deleted")
57+
raise ValueError("Curation format: some units were merged and deleted")
5458

5559
# Check the labels exclusivity
5660
for lbl in curation_dict["manual_labels"]:
@@ -253,7 +257,7 @@ def apply_curation_labels(sorting, new_unit_ids, curation_dict):
253257
group_values.append(value)
254258
if len(set(group_values)) == 1:
255259
# all group has the same label or empty
256-
sorting.set_property(key, values=group_values, ids=[new_unit_id])
260+
sorting.set_property(key, values=group_values[:1], ids=[new_unit_id])
257261
else:
258262

259263
for key in label_def["label_options"]:

0 commit comments

Comments
 (0)