33"""
44
55from __future__ import annotations
6-
7-
86import numpy as np
97
108
11- def count_matching_events (times1 , times2 , delta = 10 ):
9+ def count_matching_events (times1 , times2 : np . ndarray | list , delta : int = 10 ):
1210 """
1311 Counts matching events.
1412
@@ -39,7 +37,7 @@ def count_matching_events(times1, times2, delta=10):
3937 return len (inds2 ) + 1
4038
4139
42- def compute_agreement_score (num_matches , num1 , num2 ) :
40+ def compute_agreement_score (num_matches : int , num1 : int , num2 : int ) -> float :
4341 """
4442 Computes agreement score.
4543
@@ -232,8 +230,8 @@ def make_match_count_matrix(sorting1, sorting2, delta_frames, ensure_symmetry=Fa
232230 And the minimum of the two results is taken.
233231 Returns
234232 -------
235- matching_matrix : ndarray
236- A 2D numpy array of shape `(num_units_train1, num_units_train2)`. Each element `[i, j]` represents
233+ matching_matrix : pd.DataFrame
234+ A 2D pandas DataFrame of shape `(num_units_train1, num_units_train2)`. Each element `[i, j]` represents
237235 the count of matching spike pairs between unit `i` from `spike_frames_train1` and unit `j` from `spike_frames_train2`.
238236
239237 Notes
@@ -348,7 +346,7 @@ def make_agreement_scores(sorting1, sorting2, delta_frames, ensure_symmetry=True
348346 And the minimum of the two results is taken.
349347 Returns
350348 -------
351- agreement_scores : array (float)
349+ agreement_scores : pd.DataFrame
352350 The agreement score matrix.
353351 """
354352 import pandas as pd
@@ -408,9 +406,9 @@ def make_possible_match(agreement_scores, min_score):
408406
409407 Returns
410408 -------
411- best_match_12 : pd.Series
409+ best_match_12 : dict[NDArray]
412410
413- best_match_21 : pd.Series
411+ best_match_21 : dict[NDArray]
414412
415413 """
416414 unit1_ids = np .array (agreement_scores .index )
@@ -433,7 +431,7 @@ def make_possible_match(agreement_scores, min_score):
433431 return possible_match_12 , possible_match_21
434432
435433
436- def make_best_match (agreement_scores , min_score ):
434+ def make_best_match (agreement_scores , min_score ) -> "tuple[pd.Series, pd.Series]" :
437435 """
438436 Given an agreement matrix and a min_score threshold.
439437 return a dict a best match for each units independently of others.
0 commit comments