add strategy : num_template_try
@@ -317,6 +317,7 @@ class TridesclousPeeler(BaseTemplateMatchingEngine):
'ms_before': 0.8,
'ms_after': 1.2,
'num_peeler_loop': 2,
+ 'num_template_try' : 1,
}
@classmethod
@@ -513,7 +514,6 @@ def _tdc_find_spikes(traces, d, level=0):
possible_shifts = d['possible_shifts']
distances_shift = np.zeros(possible_shifts.size)
- # naively take the closest template
for i in range(peak_sample_ind.size):
sample_ind = peak_sample_ind[i]
@@ -543,9 +543,12 @@ def _tdc_find_spikes(traces, d, level=0):
distances = numba_sparse_dist(wf_short, templates_short, union_channels, possible_clusters)
- ind = np.argmin(distances)
+ # DEBUG
+ #~ ind = np.argmin(distances)
+ #~ cluster_ind = possible_clusters[ind]
+
+ for ind in np.argsort(distances)[:d['num_template_try']]:
cluster_ind = possible_clusters[ind]
- #~ print(scalar_product[ind])
chan_sparsity = d['template_sparsity'][cluster_ind, :]
template_sparse = templates[cluster_ind, :, :][:, chan_sparsity]
@@ -579,6 +582,11 @@ def _tdc_find_spikes(traces, d, level=0):
accepted = False
break
+ if accepted:
+ #~ if ind != np.argsort(distances)[0]:
+ #~ print('not first one', np.argsort(distances), ind)
+ break
+
if accepted:
amplitude = 1.
