Skip to content

Commit

Permalink
Update src/spikeinterface/core/template_tools.py
Browse files Browse the repository at this point in the history
Co-authored-by: Alessio Buccino <[email protected]>
  • Loading branch information
OlivierPeron and alejoe91 authored Oct 21, 2024
1 parent 1411c6f commit 72357a6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/spikeinterface/core/template_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ def get_dense_templates_array(one_object: Templates | SortingAnalyzer, return_sc
)
ext = one_object.get_extension("templates")
if ext is not None:
templates_array = ext.data.get("average") or ext.data.get("median")
assert templates_array is not None, "Average or median templates have not been computed."
if "average" in ext.data:
templates_array = ext.data.get("average")
elif "median" in ext.data:
templates_array = ext.data.get("median")
else:
raise ValueError("Average or median templates have not been computed.")
else:
raise ValueError("SortingAnalyzer need extension 'templates' to be computed to retrieve templates")
else:
Expand Down

0 comments on commit 72357a6

Please sign in to comment.