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:
Returns:

distance between the spike trains for each cost.

Return type:

torch.Tensor

Shape

t0:

\(T_m\)

t1:

\(T_n\)

cost and return:

\(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 cost is a float.

Warning

As in the original algorithm, using inf as the cost will only return the total number of spikes, not accounting for spikes occurring at the same time in each spike train.