elephant.unitary_event_analysis.jointJ_window_analysis¶
-
elephant.unitary_event_analysis.
jointJ_window_analysis
(data, bin_size, winsize, winstep, pattern_hash, method='analytic_TrialByTrial', t_start=None, t_stop=None, binary=True, n_surr=100)[source]¶ Calculates the joint surprise in a sliding window fashion.
Implementation is based on [ue1].
Parameters: - datalist
- A list of spike trains (neo.SpikeTrain objects) in different trials:
0-axis –> Trials
1-axis –> Neurons
2-axis –> Spike times
- bin_sizepq.Quantity
The size of bins for discretizing spike trains.
- winsizepq.Quantity
The size of the window of analysis.
- winsteppq.Quantity
The size of the window step.
- pattern_hashlist of int
list of interested patterns in hash values (see hash_from_pattern and inverse_hash_from_pattern functions)
- methodstr
- The method with which the unitary events whould be computed
‘analytic_TrialByTrial’ – > calculate the expectency (analytically) on each trial, then sum over all trials.
‘analytic_TrialAverage’ – > calculate the expectency by averaging over trials (cf. Gruen et al. 2003).
‘surrogate_TrialByTrial’ – > calculate the distribution of expected coincidences by spike time randomzation in each trial and sum over trials.
Default is ‘analytic_trialByTrial’
- t_startfloat or pq.Quantity, optional
The start time to use for the time points. If not specified, retrieved from the t_start attribute of spiketrains.
- t_stopfloat or pq.Quantity, optional
The start time to use for the time points. If not specified, retrieved from the t_stop attribute of spiketrains.
- n_surrint, optional
The number of surrogates to be used. Default is 100.
Returns: - dict
- The values of each key has the shape of
different pattern hash –> 0-axis
different window –> 1-axis
- Js: list of float
JointSurprise of different given patterns within each window.
- indices: list of list of int
A list of indices of pattern within each window.
- n_emp: list of int
The empirical number of each observed pattern.
- n_exp: list of float
The expected number of each pattern.
- rate_avg: list of float
The average firing rate of each neuron.
Raises: - ValueError
If data is not in the format, specified above.
- NotImplementedError
If binary is not True. The method works only with binary matrices at the moment.
Warns: - UserWarning
The ratio between winsize or winstep and bin_size is not an integer.