Skip to content

Commit

Permalink
better assertion message
Browse files Browse the repository at this point in the history
  • Loading branch information
h-mayorquin committed Sep 20, 2023
1 parent de14163 commit dff698f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/spikeinterface/core/sparsity.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,12 @@ def sparsify_waveforms(self, waveforms: np.ndarray, unit_index: int) -> np.ndarr
Sparse waveforms with shape (num_units, num_samples, num_active_channels).
"""

assert self.are_waveforms_dense(waveforms=waveforms), "Waveforms must be dense to sparsify them."
assert_msg = (
"Waveforms must be dense to sparsify them. "
f"Their last dimension {waveforms.shape[-1]} must be equal to the number of channels {self.num_chanenls}"
)
assert self.are_waveforms_dense(waveforms=waveforms), assert_msg

unit_id = self.unit_ids[unit_index]
non_zero_indices = self.unit_id_to_channel_indices[unit_id]
num_sparse_channels = len(non_zero_indices)
Expand Down

0 comments on commit dff698f

Please sign in to comment.