From b24e5fa121f9f4ee07022a07434f5aa3ed2736d6 Mon Sep 17 00:00:00 2001 From: chrishalcrow <57948917+chrishalcrow@users.noreply.github.com> Date: Wed, 6 Mar 2024 12:41:35 +0000 Subject: [PATCH] Check for random_spikes extension before using it --- src/spikeinterface/core/analyzer_extension_core.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/spikeinterface/core/analyzer_extension_core.py b/src/spikeinterface/core/analyzer_extension_core.py index 268513dac8..108aceab7e 100644 --- a/src/spikeinterface/core/analyzer_extension_core.py +++ b/src/spikeinterface/core/analyzer_extension_core.py @@ -319,6 +319,7 @@ def _compute_and_append(self, operators): # spikes = self.sorting_analyzer.sorting.to_spike_vector() # some_spikes = spikes[self.sorting_analyzer.random_spikes_indices] + assert self.sorting_analyzer.has_extension("random_spikes"), "compute templates requires the random_spikes extension." some_spikes = self.sorting_analyzer.get_extension("random_spikes").some_spikes() for unit_index, unit_id in enumerate(unit_ids): spike_mask = some_spikes["unit_index"] == unit_index