elephant.statistics.fanofactor¶
- elephant.statistics.fanofactor(spiketrains: List[SpikeTrain] | List[Quantity] | List[ndarray] | Trials, warn_tolerance: Quantity = array(0.1) * ms) float | List[float] | List[List[float]][source]¶
Evaluates the empirical Fano factor F of the spike counts of a list of
neo.core.SpikeTrainobjects orelephant.trialsobject.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 or
elephant.trials List of
neo.core.SpikeTrainor pq.Quantity or np.ndarray or list of spike times for which to compute the Fano factor of spike counts, or anelephant.trialsobject. If aelephant.trialsobject is used, spike trains are pooled across trials before computing the Fano factor.- warn_tolerancepq.Quantity, optional
In case of a list of input
neo.core.SpikeTrain, if their durations vary by more than warn_tolerance in their absolute values, throw a warning (see Notes). Default: 0.1 ms
- spiketrainslist or
- Returns:
- outputfloat or list of float
The Fano factor of the spike counts of the input spike trains. If a list was provided as input, output is a single number. In case an
elephant.trialsobject was provided as input, output is a list of Fano factors, one for each spike train across the trials. output is np.nan if an empty list is specified, or if all spike trains are empty. Anelephant.trialsobject without spike trains will return an empty list.
- Raises:
- TypeError
If the input spiketrains are
neo.core.SpikeTrainobjects, 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.core.SpikeTrain: if you pass e.g. 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