elephant.statistics.fanofactor¶
- elephant.statistics.fanofactor(spiketrains, warn_tolerance=array(0.1) * ms)[source]¶
Evaluates the empirical Fano factor F of the spike counts of a list of neo.SpikeTrain objects.
Given the vector v containing the observed spike counts (one per spike train) in the time window [t0, t1], F is defined as:
\[F := \frac{var(v)}{mean(v)}\]The Fano factor is typically computed for spike trains representing the activity of the same neuron over different trials. The higher F, the larger the cross-trial non-stationarity. In theory for a time-stationary Poisson process, F=1.
- Parameters:
- spiketrainslist
List of neo.SpikeTrain or pq.Quantity or np.ndarray or list of spike times for which to compute the Fano factor of spike counts.
- warn_tolerancepq.Quantity
In case of a list of input neo.SpikeTrains, if their durations vary by more than warn_tolerence in their absolute values, throw a warning (see Notes). Default: 0.1 ms
- Returns:
- fanofloat
The Fano factor of the spike counts of the input spike trains. Returns np.NaN if an empty list is specified, or if all spike trains are empty.
- Raises:
- TypeError
If the input spiketrains are neo.SpikeTrain objects, but warn_tolerance is not a quantity.
Notes
The check for the equal duration of the input spike trains is performed only if the input is of type`neo.SpikeTrain`: if you pass a numpy array, please make sure that they all have the same duration manually.
Examples
>>> import neo >>> from elephant import statistics >>> spiketrains = [ ... neo.SpikeTrain([0.3, 4.5, 6.7, 9.3], t_stop=10, units='s'), ... neo.SpikeTrain([1.4, 3.3, 8.2], t_stop=10, units='s') ... ] >>> statistics.fanofactor(spiketrains) 0.07142857142857142