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 withNneurons.- Returns:
LV of every neuron, shape
(N,).nanfor a neuron with fewer than 2 intervals, or with two consecutive zero intervals.- Return type:
Array- Raises:
TypeError – If
trainsis not aSpikeTrains.
Notes
Matches
elephant.statistics.lv(isi, with_nan=True). LV is 1 for a Poisson process and 0 for a regular train. Works underjax.jitandjax.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)