elephant.statistics.cv2¶
-
elephant.statistics.
cv2
(v, with_nan=False)[source]¶ Calculate the measure of CV2 for a sequence of time intervals between events.
Given a vector v 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: - vpq.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.
References
[1] G. R. Holt, W. R. Softky, C. Koch, & R. J. Douglas, “Comparison of discharge variability in vitro and in vivo in cat visual cortex neurons,” Journal of Neurophysiology, vol. 75, no. 5, pp. 1806-1814, 1996.