Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow MergeUnitsSorting to handle tuples #1995

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/spikeinterface/curation/mergeunitssorting.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class MergeUnitsSorting(BaseSorting):
----------
parent_sorting: Recording
The sorting object
units_to_merge: list of lists
units_to_merge: list/tuple of lists/tuples
A list of lists for every merge group. Each element needs to have at least two elements (two units to merge),
but it can also have more (merge multiple units at once).
new_unit_ids: None or list
Expand All @@ -24,6 +24,7 @@ class MergeUnitsSorting(BaseSorting):
Default: 'keep'
delta_time_ms: float or None
Number of ms to consider for duplicated spikes. None won't check for duplications

Returns
-------
sorting: Sorting
Expand All @@ -33,7 +34,7 @@ class MergeUnitsSorting(BaseSorting):
def __init__(self, parent_sorting, units_to_merge, new_unit_ids=None, properties_policy="keep", delta_time_ms=0.4):
self._parent_sorting = parent_sorting

if not isinstance(units_to_merge[0], list):
if not isinstance(units_to_merge[0], (list, tuple)):
# keep backward compatibility : the previous behavior was only one merge
units_to_merge = [units_to_merge]

Expand Down