Skip to content

Commit 3e04bd3

Browse files
authored
Use uint64 for match count (#2196)
* Use `uint64` for match count `uint16` leads to overflow and erroneous count. * Fixes the bug
1 parent db9e93b commit 3e04bd3

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/spikeinterface/comparison/comparisontools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def compute_matching_matrix(
188188
the metrics section in SpikeForest documentation.
189189
"""
190190

191-
matching_matrix = np.zeros((num_units_train1, num_units_train2), dtype=np.uint16)
191+
matching_matrix = np.zeros((num_units_train1, num_units_train2), dtype=np.uint64)
192192

193193
# Used to avoid the same spike matching twice
194194
last_match_frame1 = -np.ones_like(matching_matrix, dtype=np.int64)
@@ -235,7 +235,7 @@ def compute_matching_matrix(
235235
def make_match_count_matrix(sorting1, sorting2, delta_frames):
236236
num_units_sorting1 = sorting1.get_num_units()
237237
num_units_sorting2 = sorting2.get_num_units()
238-
matching_matrix = np.zeros((num_units_sorting1, num_units_sorting2), dtype=np.uint16)
238+
matching_matrix = np.zeros((num_units_sorting1, num_units_sorting2), dtype=np.uint64)
239239

240240
spike_vector1_segments = sorting1.to_spike_vector(concatenated=False)
241241
spike_vector2_segments = sorting2.to_spike_vector(concatenated=False)

0 commit comments

Comments
 (0)