burst_synchrony_index

burst_synchrony_index#

class braintools.analysis.spike.burst_synchrony_index(spike_matrix, burst_threshold=3, max_isi=100.0, dt=None)#

Calculate burst synchrony index based on co-occurring burst events.

This measure identifies burst events in each spike train and quantifies the synchronization of these bursts across the population.

A burst is defined as a sequence of at least burst_threshold spikes with inter-spike intervals ≤ max_isi. The index is the fraction of bursts that overlap in time (endpoints included) with a burst of another neuron.

Parameters:
  • spike_matrix (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Spike matrix with shape (n_time_steps, n_neurons).

  • burst_threshold (int) – Minimum number of spikes required to constitute a burst.

  • max_isi (float) – Maximum inter-spike interval within a burst. Must use the same time unit as dt.

  • dt (float | None) – Time step between successive samples. If None, uses the default from brainstate.environ.get_dt(). A plain float is assumed to be in milliseconds (the brainstate convention), so it must be expressed in the same unit as window_size/max_isi/tau; a brainunit.Quantity is converted automatically.

Returns:

Burst synchrony index between 0 (no burst synchrony) and 1 (perfect burst synchrony).

Return type:

float

Notes

The bursts of all neurons are found at once from the sorted spike list (a new burst starts at every neuron change or ISI above max_isi), and the overlapping bursts are counted with two binary searches over the sorted burst starts and ends, in O(S log S) for S spikes. Bursts of the same neuron never overlap, so only other neurons’ bursts are counted.

This function runs on host (concrete) arrays with NumPy and returns a Python float, so it is not jit/vmap/grad-compatible.

Examples

>>> import jax.numpy as jnp
>>> import braintools
>>> spikes = jnp.zeros((1000, 10))
>>> for start in [100, 300, 600]:
...     spikes = spikes.at[start:start + 5, :].set(1)
>>> sync_idx = braintools.analysis.spike.burst_synchrony_index(spikes, max_isi=5.0, dt=1.0)
>>> sync_idx
1.0