elephant.statistics.lv¶
-
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 containing a sequence of intervals, the Lv is defined as:
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.
Parameters: - 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
Returns: - float
The Lv of the inter-spike interval of the input sequence.
Raises: - ValueError
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.
Warns: - UserWarning
If with_nan is True and the Lv is calculated for a spike train with less than two spikes, generating a np.NaN.
Examples
>>> from elephant import statistics >>> statistics.lv([0.3, 4.5, 6.7, 9.3]) 0.8306154336734695