Skip to content

Commit

Permalink
Use uint64 for match count (#2196)
Browse files Browse the repository at this point in the history
* Use `uint64` for match count

`uint16` leads to overflow and erroneous count.

* Fixes the bug
  • Loading branch information
DradeAW authored Nov 13, 2023
1 parent db9e93b commit 3e04bd3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/spikeinterface/comparison/comparisontools.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def compute_matching_matrix(
the metrics section in SpikeForest documentation.
"""

matching_matrix = np.zeros((num_units_train1, num_units_train2), dtype=np.uint16)
matching_matrix = np.zeros((num_units_train1, num_units_train2), dtype=np.uint64)

# Used to avoid the same spike matching twice
last_match_frame1 = -np.ones_like(matching_matrix, dtype=np.int64)
Expand Down Expand Up @@ -235,7 +235,7 @@ def compute_matching_matrix(
def make_match_count_matrix(sorting1, sorting2, delta_frames):
num_units_sorting1 = sorting1.get_num_units()
num_units_sorting2 = sorting2.get_num_units()
matching_matrix = np.zeros((num_units_sorting1, num_units_sorting2), dtype=np.uint16)
matching_matrix = np.zeros((num_units_sorting1, num_units_sorting2), dtype=np.uint64)

spike_vector1_segments = sorting1.to_spike_vector(concatenated=False)
spike_vector2_segments = sorting2.to_spike_vector(concatenated=False)
Expand Down

0 comments on commit 3e04bd3

Please sign in to comment.