Skip to content

Commit

Permalink
Small fixes in curation format and apply_curation()
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelgarcia committed Jan 8, 2025
1 parent a64aed9 commit 0deac03
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/spikeinterface/curation/curation_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,16 @@ def validate_curation_dict(curation_dict):
if not removed_units_set.issubset(unit_set):
raise ValueError("Curation format: some removed units are not in the unit list")

for group in curation_dict["merge_unit_groups"]:
if len(group) < 2:
raise ValueError("Curation format: 'merge_unit_groups' must be list of list with at least 2 elements")

all_merging_groups = [set(group) for group in curation_dict["merge_unit_groups"]]
for gp_1, gp_2 in combinations(all_merging_groups, 2):
if len(gp_1.intersection(gp_2)) != 0:
raise ValueError("Some units belong to multiple merge groups")
raise ValueError("Curation format: some units belong to multiple merge groups")
if len(removed_units_set.intersection(merged_units_set)) != 0:
raise ValueError("Some units were merged and deleted")
raise ValueError("Curation format: some units were merged and deleted")

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

for key in label_def["label_options"]:
Expand Down

0 comments on commit 0deac03

Please sign in to comment.