voltage_fluctuation

voltage_fluctuation#

class brainpy.measure.voltage_fluctuation(potentials, method='loop')#

Calculate neuronal synchronization via voltage variance analysis.

This method quantifies synchronization by comparing the variance of the population-averaged membrane potential to the average variance of individual neurons’ membrane potentials.

The synchronization measure is computed as:

\[\chi^2(N) = \frac{\sigma_V^2}{\frac{1}{N} \sum_{i=1}^N \sigma_{V_i}^2}\]

where:

  • \(\sigma_V^2\) is the variance of the population average potential

  • \(\sigma_{V_i}^2\) is the variance of individual neuron potentials

  • \(N\) is the number of neurons

The population average potential is:

\[V(t) = \frac{1}{N} \sum_{i=1}^{N} V_i(t)\]

And its variance is:

\[\sigma_V^2 = \left\langle V(t)^2 \right\rangle_t - \left\langle V(t) \right\rangle_t^2\]
Parameters:
  • potentials (brainstate.typing.ArrayLike) – Membrane potential matrix with shape (num_time, num_neurons). Contains the voltage traces for each neuron over time.

  • method (str, default 'loop') –

    Computational method:

    • 'loop': Memory-efficient iterative computation

    • 'vmap': Vectorized computation (higher memory usage)

Returns:

Scalar (0-d array) synchronization index, bounded in approximately [1/N, 1]. Values near 1 indicate strong synchrony; values near 1/N indicate asynchronous activity. (The ratio of the population-mean variance to the mean single-neuron variance cannot exceed 1.) By convention a constant (zero-variance) population returns 1.0.

Return type:

jax.Array

Examples

>>> import brainstate
>>> import jax.numpy as jnp
>>> import braintools
>>> t = jnp.linspace(0, 10, 1000)
>>> # Synchronous case: shared oscillation + small independent noise.
>>> common = jnp.sin(2 * jnp.pi * t)[:, None]
>>> sync = common + 0.1 * brainstate.random.normal(size=(1000, 10))
>>> async_ = brainstate.random.normal(size=(1000, 10))
>>> bool(braintools.metric.voltage_fluctuation(sync)
...      > braintools.metric.voltage_fluctuation(async_))
True

References