Skip to content

Commit

Permalink
alessio suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
h-mayorquin committed Sep 20, 2023
1 parent 1ec93b5 commit 54d92a2
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/spikeinterface/core/sparsity.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,6 @@ def sparsify_waveforms(self, waveforms: np.ndarray, unit_id: str) -> np.ndarray:
assert self.are_waveforms_dense(waveforms=waveforms), assert_msg

non_zero_indices = self.unit_id_to_channel_indices[unit_id]
num_active_channels = len(non_zero_indices)
sparsified_shape = waveforms.shape[:-1] + (num_active_channels,)
sparsified_waveforms = np.zeros(sparsified_shape, dtype=waveforms.dtype)
sparsified_waveforms = waveforms[..., non_zero_indices]

return sparsified_waveforms
Expand Down Expand Up @@ -194,7 +191,7 @@ def densify_waveforms(self, waveforms: np.ndarray, unit_id: str) -> np.ndarray:

densified_shape = waveforms.shape[:-1] + (self.num_channels,)
densified_waveforms = np.zeros(densified_shape, dtype=waveforms.dtype)
densified_waveforms[..., non_zero_indices] = waveforms[...]
densified_waveforms[..., non_zero_indices] = waveforms

return densified_waveforms

Expand Down

0 comments on commit 54d92a2

Please sign in to comment.