Skip to content

Commit

Permalink
Fix value error by checking first dict key type
Browse files Browse the repository at this point in the history
  • Loading branch information
rkim48 committed Aug 16, 2024
1 parent 1356d3a commit d029f7d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/spikeinterface/curation/curation_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,13 @@ def convert_from_sortingview_curation_format_v0(sortingview_dict, destination_fo
sortingview_dict["mergeGroups"] = []
merge_groups = sortingview_dict["mergeGroups"]
merged_units = sum(merge_groups, [])
if len(merged_units) > 0:
unit_id_type = int if isinstance(merged_units[0], int) else str

first_unit_id = next(iter(sortingview_dict["labelsByUnit"].keys()))
if str.isdigit(first_unit_id):
unit_id_type = int
else:
unit_id_type = str

all_units = []
all_labels = []
manual_labels = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,13 @@ def test_json_no_merge_curation():
sorting = generate_sorting(num_units=10)

json_file = parent_folder / "sv-sorting-curation-no-merge.json"
sorting_curated_json = apply_sortingview_curation(sorting, uri_or_json=json_file)
# ValueError: Curation format: some labeled units are not in the unit list
sorting_curated = apply_sortingview_curation(sorting, uri_or_json=json_file)


if __name__ == "__main__":
# generate_sortingview_curation_dataset()
# test_sha1_curation()

test_gh_curation()
test_json_curation()
test_false_positive_curation()
Expand Down

0 comments on commit d029f7d

Please sign in to comment.