victor_purpura_pair_dist¶
- victor_purpura_pair_dist(t0: Tensor, t1: Tensor, cost: float | Tensor) Tensor[source]¶
Victor–Purpura distance between a pair of spike trains.
This function is not fully vectorized and may be slow. It take care when using it on performance critical pathways.
Uses a Needleman–Wunsch approach. Translated from the MATLAB code by Thomas Kreuz.
- Parameters:
t0 (torch.Tensor) – spike times of the first spike train.
t1 (torch.Tensor) – spike times of the second spike train.
cost (float | torch.Tensor) – cost to move a spike by one unit of time.
- Returns:
distance between the spike trains for each cost.
- Return type:
Shape
t0:\(T_m\)
t1:\(T_n\)
costandreturn:\(k\)
- Where:
\(T_m\) number of spikes in the first spike train.
\(T_n\) number of spikes in the second spike train.
\(k\), number of cost values to compute distance for, treated as \(1\) when
costis a float.
Warning
As in the original algorithm, using
infas the cost will only return the total number of spikes, not accounting for spikes occurring at the same time in each spike train.