elephant.statistics.time_histogram

elephant.statistics.time_histogram(spiketrains, bin_size, t_start=None, t_stop=None, output='counts', binary=False)[source]

Time Histogram of a list of neo.SpikeTrain objects.

Parameters:
spiketrainslist of neo.SpikeTrain

neo.SpikeTrain`s with a common time axis (same `t_start and t_stop)

bin_sizepq.Quantity

Width of the histogram’s time bins.

t_startpq.Quantity, optional

Start time of the histogram. Only events in spiketrains falling between t_start and t_stop (both included) are considered in the histogram. If None, the maximum t_start of all neo.SpikeTrain`s is used as `t_start. Default: None.

t_stoppq.Quantity, optional

Stop time of the histogram. Only events in spiketrains falling between t_start and t_stop (both included) are considered in the histogram. If None, the minimum t_stop of all neo.SpikeTrain`s is used as `t_stop. Default: None.

output{‘counts’, ‘mean’, ‘rate’}, optional

Normalization of the histogram. Can be one of: * ‘counts’: spike counts at each bin (as integer numbers) * ‘mean’: mean spike counts per spike train * ‘rate’: mean spike rate per spike train. Like ‘mean’, but the

counts are additionally normalized by the bin width.

Default: ‘counts’.

binarybool, optional

If True, indicates whether all neo.SpikeTrain objects should first be binned to a binary representation (using the conversion.BinnedSpikeTrain class) and the calculation of the histogram is based on this representation. Note that the output is not binary, but a histogram of the converted, binary representation. Default: False.

Returns:
neo.AnalogSignal

A neo.AnalogSignal object containing the histogram values. neo.AnalogSignal[j] is the histogram computed between t_start + j * bin_size and t_start + (j + 1) * bin_size.

Raises:
ValueError

If output is not ‘counts’, ‘mean’ or ‘rate’.

Warns:
UserWarning

If t_start is None and the objects in spiketrains have different t_start values. If t_stop is None and the objects in spiketrains have different t_stop values.