Skip to content

Commit

Permalink
Merge branch 'main' into docker_si_install_options
Browse files Browse the repository at this point in the history
  • Loading branch information
alejoe91 authored Jan 12, 2024
2 parents cd62a3e + 9c2b66f commit 5dd7ffa
Show file tree
Hide file tree
Showing 6 changed files with 742 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/spikeinterface/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,5 @@

# channel sparsity
from .sparsity import ChannelSparsity, compute_sparsity

from .template import Templates
14 changes: 12 additions & 2 deletions src/spikeinterface/core/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ def __post_init__(self):
if not self._are_passed_templates_sparse():
raise ValueError("Sparsity mask passed but the templates are not sparse")

def get_one_template_dense(self, unit_index):
if self.sparsity is None:
template = self.templates_array[unit_index, :, :]
else:
sparse_template = self.templates_array[unit_index, :, :]
template = self.sparsity.densify_waveforms(waveforms=sparse_template, unit_id=self.unit_ids[unit_index])
# dense_waveforms[unit_index, ...] = self.sparsity.densify_waveforms(waveforms=waveforms, unit_id=unit_id)
return template

def get_dense_templates(self) -> np.ndarray:
# Assumes and object without a sparsity mask already has dense templates
if self.sparsity is None:
Expand All @@ -111,8 +120,9 @@ def get_dense_templates(self) -> np.ndarray:
dense_waveforms = np.zeros(shape=densified_shape, dtype=self.templates_array.dtype)

for unit_index, unit_id in enumerate(self.unit_ids):
waveforms = self.templates_array[unit_index, ...]
dense_waveforms[unit_index, ...] = self.sparsity.densify_waveforms(waveforms=waveforms, unit_id=unit_id)
# waveforms = self.templates_array[unit_index, ...]
# dense_waveforms[unit_index, ...] = self.sparsity.densify_waveforms(waveforms=waveforms, unit_id=unit_id)
dense_waveforms[unit_index, ...] = self.get_one_template_dense(unit_index)

return dense_waveforms

Expand Down
7 changes: 7 additions & 0 deletions src/spikeinterface/generation/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from .drift_tools import (
move_dense_templates,
interpolate_templates,
DriftingTemplates,
InjectDriftingTemplatesRecording,
make_linear_displacement,
)
Loading

0 comments on commit 5dd7ffa

Please sign in to comment.