braintools.analysis.spike.isi#
- braintools.analysis.spike.isi(trains)#
Compute the inter-spike intervals of every neuron.
For neuron \(n\) with spike times \(t_1 < \dots < t_{c_n}\), the intervals are \(I_k = t_{k+1} - t_k\), \(k = 1, \dots, c_n - 1\).
- Parameters:
trains (
SpikeTrains) – Spike trains withNneurons and capacityK.- Returns:
Intervals of shape
(N, K - 1), padded withnanbeyond entrycounts - 1of every row. A Quantity in the unit of the spike times when they carry one.- Return type:
- Raises:
TypeError – If
trainsis not aSpikeTrains.
Notes
The output shape depends only on the capacity, so the function works under
jax.jitandjax.vmapand is differentiable with respect to the spike times (the padding receives zero gradient).Examples
>>> import brainunit as u >>> import jax.numpy as jnp >>> from braintools.spike import SpikeTrains >>> from braintools.analysis.spike import isi >>> raster = jnp.zeros((10, 2)).at[jnp.array([0, 2, 7]), 0].set(1).at[4, 1].set(1) >>> st = SpikeTrains.from_dense(raster, dt=1. * u.ms) >>> isi(st) Quantity([[ 2. 5.] [nan nan]], "ms")