Skip to content

Commit

Permalink
fix waveform extactor with empty sorting and sparse
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelgarcia committed Oct 4, 2023
1 parent 590cd6b commit 204c8e9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/spikeinterface/core/sparsity.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ def __init__(self, mask, unit_ids, channel_ids):

self.num_channels = self.channel_ids.size
self.num_units = self.unit_ids.size
self.max_num_active_channels = self.mask.sum(axis=1).max()
if self.mask.shape[0]:
self.max_num_active_channels = self.mask.sum(axis=1).max()
else:
# empty sorting without units
self.max_num_active_channels = 0

def __repr__(self):
density = np.mean(self.mask)
Expand Down
3 changes: 2 additions & 1 deletion src/spikeinterface/core/tests/test_waveform_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,4 +556,5 @@ def test_non_json_object():
# test_portability()
# test_recordingless()
# test_compute_sparsity()
test_non_json_object()
# test_non_json_object()
test_empty_sorting()

0 comments on commit 204c8e9

Please sign in to comment.