Skip to content

Commit

Permalink
Added get_random_spikes method to MockWaveformExtractor
Browse files Browse the repository at this point in the history
  • Loading branch information
chrishalcrow committed Mar 6, 2024
1 parent b24e5fa commit feff156
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/spikeinterface/core/analyzer_extension_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,9 @@ 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."
assert (
self.sorting_analyzer.has_extension("random_spikes")
), "compute templates requires the random_spikes extension. You can run WaveformExtractor.get_random_spikes()"
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,10 @@ def delete_waveforms(self) -> None:
self.sorting_analyzer.delete_extension("waveforms")

def delete_extension(self, extension) -> None:
self.sorting_analyzer.delete_extension(extension)
self.sorting_analyzer.delete_extension()

def get_random_spikes(self) -> None:
self.sorting_analyzer.compute("random_spikes")

@property
def recording(self) -> BaseRecording:
Expand Down

0 comments on commit feff156

Please sign in to comment.