Skip to content

Commit

Permalink
Merge branch 'SpikeInterface:main' into meta_merging
Browse files Browse the repository at this point in the history
  • Loading branch information
yger authored Oct 31, 2024
2 parents e913a7b + 5bdcfce commit a396275
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/spikeinterface/curation/auto_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,19 @@ def compute_merge_unit_groups(
raise ValueError(f"preset must be one of {list(_compute_merge_presets.keys())}")
steps = _compute_merge_presets[preset]

if force_copy:
# check at least one extension is needed
at_least_one_extension_to_compute = False
for step in steps:
assert step in _default_step_params, f"{step} is not a valid step"
if step in _required_extensions:
for ext in _required_extensions[step]:
if sorting_analyzer.has_extension(ext):
continue
if not compute_needed_extensions:
raise ValueError(f"{step} requires {ext} extension")
at_least_one_extension_to_compute = True

if force_copy and at_least_one_extension_to_compute:
# To avoid erasing the extensions of the user
sorting_analyzer = sorting_analyzer.copy()

Expand All @@ -205,14 +217,10 @@ def compute_merge_unit_groups(

for step in steps:

assert step in _default_step_params, f"{step} is not a valid step"

if step in _required_extensions:
for ext in _required_extensions[step]:
if sorting_analyzer.has_extension(ext):
continue
if not compute_needed_extensions:
raise ValueError(f"{step} requires {ext} extension")

# special case for templates
if ext == "templates" and not sorting_analyzer.has_extension("random_spikes"):
Expand Down

0 comments on commit a396275

Please sign in to comment.