Skip to content

Commit 0adfa25

Browse files
Patch lag similarities (#4345)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 2fe55d8 commit 0adfa25

File tree

2 files changed

+2
-16
lines changed

2 files changed

+2
-16
lines changed

src/spikeinterface/postprocessing/template_similarity.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,6 @@ def _compute_similarity_matrix_numpy(
234234
overlapping_templates = np.flatnonzero(np.sum(local_mask, 1))
235235
tgt_templates = tgt_sliced_templates[overlapping_templates]
236236
for gcount, j in enumerate(overlapping_templates):
237-
# symmetric values are handled later
238-
if same_array and j < i:
239-
# no need exhaustive looping when same template
240-
continue
241237
src = src_template[:, local_mask[j]].reshape(1, -1)
242238
tgt = (tgt_templates[gcount][:, local_mask[j]]).reshape(1, -1)
243239

@@ -259,10 +255,8 @@ def _compute_similarity_matrix_numpy(
259255
distances[count, i, j] = 1 - distances[count, i, j]
260256

261257
if same_array:
262-
distances[count, j, i] = distances[count, i, j]
258+
distances[num_shifts_both_sides - count - 1, j, i] = distances[count, i, j]
263259

264-
if same_array and num_shifts != 0:
265-
distances[num_shifts_both_sides - count - 1] = distances[count].T
266260
return distances
267261

268262

@@ -331,10 +325,6 @@ def _compute_similarity_matrix_numba(
331325
for gcount in range(len(overlapping_templates)):
332326

333327
j = overlapping_templates[gcount]
334-
# symmetric values are handled later
335-
if same_array and j < i:
336-
# no need exhaustive looping when same template
337-
continue
338328
src = src_template[:, local_mask[j]].flatten()
339329
tgt = (tgt_templates[gcount][:, local_mask[j]]).flatten()
340330

@@ -370,10 +360,7 @@ def _compute_similarity_matrix_numba(
370360
distances[count, i, j] = 1 - distances[count, i, j]
371361

372362
if same_array:
373-
distances[count, j, i] = distances[count, i, j]
374-
375-
if same_array and num_shifts != 0:
376-
distances[num_shifts_both_sides - count - 1] = distances[count].T
363+
distances[num_shifts_both_sides - count - 1, j, i] = distances[count, i, j]
377364

378365
return distances
379366

src/spikeinterface/sorters/internal/lupin.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ def _run_from_folder(cls, sorter_output_folder, params, verbose):
109109
from spikeinterface.sortingcomponents.peak_detection import detect_peaks
110110
from spikeinterface.sortingcomponents.peak_selection import select_peaks
111111
from spikeinterface.sortingcomponents.clustering.main import find_clusters_from_peaks, clustering_methods
112-
from spikeinterface.sortingcomponents.tools import remove_empty_templates
113112
from spikeinterface.preprocessing import correct_motion
114113
from spikeinterface.sortingcomponents.motion import InterpolateMotionRecording
115114
from spikeinterface.sortingcomponents.tools import clean_templates, compute_sparsity_from_peaks_and_label

0 commit comments

Comments
 (0)