elephant.statistics.cv2¶
-
elephant.statistics.
cv2
(time_intervals, with_nan=False)[source]¶ Calculate the measure of Cv2 for a sequence of time intervals between events [st2].
Given a vector containing a sequence of intervals, the Cv2 is defined as:
The Cv2 is typically computed as a substitute for the classical coefficient of variation (Cv) for sequences of events which include some (relatively slow) rate fluctuation. As with the Cv, Cv2=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, cv2 of a spike train with less than two spikes results in a np.NaN value and a warning is raised. If False, ValueError exception is raised with a spike train with less than two spikes. Default: True
Returns: - float
The Cv2 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 cv2 is calculated for a sequence with less than two entries, generating a np.NaN.
Examples
>>> from elephant import statistics >>> statistics.cv2([0.3, 4.5, 6.7, 9.3]) 0.8226190476190478