elephant.statistics.lv(time_intervals, with_nan=False)[source]

Calculate the measure of local variation Lv for a sequence of time intervals between events [st4].

Given a vector I containing a sequence of intervals, the Lv is defined as:

Lv := \frac{1}{N} \sum_{i=1}^{N-1}

The Lv is typically computed as a substitute for the classical coefficient of variation for sequences of events which include some (relatively slow) rate fluctuation. As with the Cv, Lv=1 for a sequence of intervals generated by a Poisson process.

time_intervalspq.Quantity or np.ndarray or list

Vector of consecutive time intervals.

with_nanbool, optional

If True, the Lv of a spike train with less than two spikes results in a np.NaN value and a warning is raised. If False, a ValueError exception is raised with a spike train with less than two spikes. Default: True


The Lv of the inter-spike interval of the input sequence.


If an empty list is specified, or if the sequence has less than two entries and with_nan is False.

If a matrix is passed to the function. Only vector inputs are supported.


If with_nan is True and the Lv is calculated for a spike train with less than two spikes, generating a np.NaN.


>>> from elephant import statistics
>>> statistics.lv([0.3, 4.5, 6.7, 9.3])