braintools.analysis.spike.lv

Contents

braintools.analysis.spike.lv#

braintools.analysis.spike.lv(trains)#

Compute the local variation LV of Shinomoto et al. (2003).

\[\mathrm{LV} = \frac{3}{n-1} \sum_{k=1}^{n-1} \left(\frac{I_k - I_{k+1}}{I_k + I_{k+1}}\right)^2,\]

for the \(n\) intervals \(I_k\) of a neuron [1].

Parameters:

trains (SpikeTrains) – Spike trains with N neurons.

Returns:

LV of every neuron, shape (N,). nan for a neuron with fewer than 2 intervals, or with two consecutive zero intervals.

Return type:

Array

Raises:

TypeError – If trains is not a SpikeTrains.

See also

isi, cv, cv2

Notes

Matches elephant.statistics.lv(isi, with_nan=True). LV is 1 for a Poisson process and 0 for a regular train. Works under jax.jit and jax.vmap, and is differentiable with respect to the spike times.

References

Examples

>>> import jax.numpy as jnp
>>> from braintools.spike import SpikeTrains
>>> from braintools.analysis.spike import lv
>>> raster = jnp.zeros((10, 1)).at[jnp.array([0, 1, 4]), 0].set(1)
>>> st = SpikeTrains.from_dense(raster, dt=1.)
>>> lv(st)
Array([0.75], dtype=float32)