# TODO: a couple of approaches. 1) do everything in 3D, draw a sphere around prediction, take spikes only within the sphere
# 2) do separate for x, y. But resolution will be much lower, making things noisier, also harder to determine threshold.
# 3) just use depth. Probably go for that. check with others.
norm_weights = (
pc_features / np.sum(pc_features, axis=1)[:, np.newaxis]
) # TOOD: discuss use of square. Probbaly do not use to keep in line with COM in SI.
# TODO: now max site per spike is computed from PCs, not as the channel max site as previous
spike_max_sites = spike_features_indices[
np.arange(spike_features_indices.shape[0]), np.argmax(norm_weights, axis=1)
]
# Zero any small channel amplitudes TODO: removed this.
# threshold_values = 0.3 * template_amplitudes_unscaled TODO: remove this to be more general. Agree?
# template_amplitudes_per_channel[template_amplitudes_per_channel < threshold_values[:, np.newaxis]] = 0
# Get channel with the largest amplitude (take that as the waveform)
template_max_site = np.argmax(
np.max(np.abs(unwhite_templates), axis=1), axis=1
) # TODO: i changed this to use unwhitened templates instead of templates. This okay?
# Use template channel with max signal as waveform
waveforms = np.empty(
unwhite_templates.shape[:2]
) # TODO: i changed this to use unwhitened templates instead of templates. This okay?
[In progress] continuation from #3499