Fix error in template tools
@@ -2,6 +2,7 @@ import numpy as np
from ..utils import get_channel_distances
+
def get_template_amplitudes(waveform_extractor, peak_sign='neg', mode='extremum'):
"""
Get amplitude per channel for each units
@@ -65,11 +66,12 @@ def get_template_extremum_channel(waveform_extractor, peak_sign='neg', outputs=
elif outputs == 'index':
return extremum_channels_index
+
def get_template_channel_sparsity(waveform_extractor, method='best_channels',
peak_sign='neg', num_channels=None, radius_um=None, outputs='id'):
"""
Get channel sparsity for each template with several methods:
- * "best_channels": get N best channel, channels are orderer in that case
+ * "best_channels": get N best channel, channels are ordered in that case
* "radius": radius un um around the best channel, channels are not ordered
* "threshold" : TODO
@@ -101,7 +103,7 @@ def get_template_channel_sparsity(waveform_extractor, method='best_channels',
sparsity_with_index[unit_id] = chan_inds
elif method == 'threshold':
- raise NotImplemetedError
+ raise NotImplementedError
# handle output ids or indexes
if outputs == 'id':
@@ -114,7 +116,6 @@ def get_template_channel_sparsity(waveform_extractor, method='best_channels',
return sparsity_with_index
-
def get_template_extremum_channel_peak_shift(waveform_extractor, peak_sign='neg'):
"""
In some situtaion some sorters, return spike index with a smal shift related to the extremum peak
@@ -149,9 +150,6 @@ def get_template_extremum_channel_peak_shift(waveform_extractor, peak_sign='neg'
return shifts
-
-
-
def get_template_extremum_amplitude(waveform_extractor, peak_sign='neg'):
"""
Computes amplitudes on the best channel.
@@ -170,7 +168,6 @@ def get_template_extremum_amplitude(waveform_extractor, peak_sign='neg'):
chan_ind = waveform_extractor.recording.id_to_index(chan_id)
unit_amplitudes[unit_id] = template[before, chan_ind]
-
return unit_amplitudes
@@ -196,10 +193,8 @@ def compute_unit_centers_of_mass(waveform_extractor, peak_sign='neg', num_channe
best_channel_ids = get_template_channel_sparsity(waveform_extractor, method='best_channels',
peak_sign=peak_sign, num_channels=num_channels, outputs='id')
-
amplitudes = get_template_amplitudes(waveform_extractor, peak_sign=peak_sign)
-
coms = []
for unit_id in unit_ids:
template = waveform_extractor.get_template(unit_id)
