Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 24, 2024
1 parent 7d8ef31 commit b77d0b0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/spikeinterface/postprocessing/template_similarity.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def _get_data(self):
register_result_extension(ComputeTemplateSimilarity)
compute_template_similarity = ComputeTemplateSimilarity.function_factory()


def _compute_similarity_matrix_numpy(templates_array, other_templates_array, num_shifts, mask, method):

num_templates = templates_array.shape[0]
Expand Down Expand Up @@ -215,6 +216,7 @@ def _compute_similarity_matrix_numpy(templates_array, other_templates_array, num
if HAVE_NUMBA:

from math import sqrt

@numba.jit(nopython=True, parallel=True, fastmath=True, nogil=True)
def _compute_similarity_matrix_numba(templates_array, other_templates_array, num_shifts, mask, method):
num_templates = templates_array.shape[0]
Expand All @@ -234,11 +236,11 @@ def _compute_similarity_matrix_numba(templates_array, other_templates_array, num
else:
shift_loop = range(-num_shifts, num_shifts + 1)

if method == 'l1':
if method == "l1":
metric = 0
elif method == 'l2':
elif method == "l2":
metric = 1
elif method == 'cosine':
elif method == "cosine":
metric = 2

for count, shift in enumerate(shift_loop):
Expand Down Expand Up @@ -292,15 +294,14 @@ def _compute_similarity_matrix_numba(templates_array, other_templates_array, num

if same_array and num_shifts != 0:
distances[num_shifts_both_sides - count - 1] = distances[count].T

return distances

_compute_similarity_matrix = _compute_similarity_matrix_numba
else:
_compute_similarity_matrix = _compute_similarity_matrix_numpy



def compute_similarity_with_templates_array(
templates_array, other_templates_array, method, support="union", num_shifts=0, sparsity=None, other_sparsity=None
):
Expand Down

0 comments on commit b77d0b0

Please sign in to comment.