pynapple.process.correlograms#
Functions to compute correlograms of timestamps data.
Functions
|
Computes the autocorrelogram of a group of Ts/Tsd objects. |
|
Computes all the pairwise cross-correlograms for TsGroup or list/tuple of two TsGroup. |
|
Computes the correlograms of a group of Ts/Tsd objects with another single Ts/Tsd object The time of reference is the event times. |
- pynapple.process.correlograms.compute_autocorrelogram(group, binsize, windowsize, ep=None, norm=True, time_units='s')[source]#
Computes the autocorrelogram of a group of Ts/Tsd objects. The group can be passed directly as a TsGroup object.
- Parameters:
group (TsGroup) – The group of Ts/Tsd objects to auto-correlate
binsize (float) – The bin size. Default is second. If different, specify with the parameter time_units (‘s’ [default], ‘ms’, ‘us’).
windowsize (float) – The window size. Default is second. If different, specify with the parameter time_units (‘s’ [default], ‘ms’, ‘us’).
ep (IntervalSet) – The epoch on which auto-corrs are computed. If None, the epoch is the time support of the group.
norm (bool, optional) – If True, autocorrelograms are normalized to baseline (i.e. divided by the average rate) If False, autoorrelograms are returned as the rate (Hz) of the time series (relative to itself)
time_units (str, optional) – The time units of the parameters. They have to be consistent for binsize and windowsize. (‘s’ [default], ‘ms’, ‘us’).
- Returns:
_
- Return type:
pandas.DataFrame
- Raises:
RuntimeError – group must be TsGroup
- pynapple.process.correlograms.compute_crosscorrelogram(group, binsize, windowsize, ep=None, norm=True, time_units='s', reverse=False)[source]#
Computes all the pairwise cross-correlograms for TsGroup or list/tuple of two TsGroup.
If input is TsGroup only, the reference Ts/Tsd and target are chosen based on the builtin itertools.combinations function. For example if indexes are [0,1,2], the function computes cross-correlograms for the pairs (0,1), (0, 2), and (1, 2). The left index gives the reference time series. To reverse the order, set reverse=True.
If input is tuple/list of TsGroup, for example group=(group1, group2), the reference for each pairs comes from group1.
- Parameters:
group (TsGroup or tuple/list of two TsGroups)
binsize (float) – The bin size. Default is second. If different, specify with the parameter time_units (‘s’ [default], ‘ms’, ‘us’).
windowsize (float) – The window size. Default is second. If different, specify with the parameter time_units (‘s’ [default], ‘ms’, ‘us’).
ep (IntervalSet) – The epoch on which cross-corrs are computed. If None, the epoch is the time support of the group.
norm (bool, optional) – If True (default), cross-correlograms are normalized to baseline (i.e. divided by the average rate of the target time series) If False, cross-orrelograms are returned as the rate (Hz) of the target time series ((relative to the reference time series)
time_units (str, optional) – The time units of the parameters. They have to be consistent for binsize and windowsize. (‘s’ [default], ‘ms’, ‘us’).
reverse (bool, optional) – To reverse the pair order if input is TsGroup
- Returns:
_
- Return type:
pandas.DataFrame
- Raises:
RuntimeError – group must be TsGroup or tuple/list of two TsGroups
- pynapple.process.correlograms.compute_eventcorrelogram(group, event, binsize, windowsize, ep=None, norm=True, time_units='s')[source]#
Computes the correlograms of a group of Ts/Tsd objects with another single Ts/Tsd object The time of reference is the event times.
- Parameters:
group (TsGroup) – The group of Ts/Tsd objects to correlate with the event
event (Ts/Tsd) – The event to correlate the each of the time series in the group with.
binsize (float) – The bin size. Default is second. If different, specify with the parameter time_units (‘s’ [default], ‘ms’, ‘us’).
windowsize (float) – The window size. Default is second. If different, specify with the parameter time_units (‘s’ [default], ‘ms’, ‘us’).
ep (IntervalSet) – The epoch on which cross-corrs are computed. If None, the epoch is the time support of the event.
norm (bool, optional) – If True (default), cross-correlograms are normalized to baseline (i.e. divided by the average rate of the target time series) If False, cross-orrelograms are returned as the rate (Hz) of the target time series (relative to the event time series)
time_units (str, optional) – The time units of the parameters. They have to be consistent for binsize and windowsize. (‘s’ [default], ‘ms’, ‘us’).
- Returns:
_
- Return type:
pandas.DataFrame
- Raises:
RuntimeError – group must be TsGroup