CAD [1] is a method aimed to capture structures of higher-order correlation in massively parallel spike trains. In particular, it is able to extract patterns of spikes with arbitrary configuration of time lags (time interval between spikes in a pattern), and at multiple time scales, e.g. from synchronous patterns to firing rate co-modulations.
CAD consists of a statistical parametric testing done on the level of pairs of neurons, followed by an agglomerative recursive algorithm, in order to detect and test statistically precise repetitions of spikes in the data. In particular, pairs of neurons are tested for significance under the null hypothesis of independence, and then the significant pairs are agglomerated into higher order patterns.
The method was published in Russo et al. 2017 [1]. The original code is in Matlab language.
Given a list of discretized (binned) spike trains by a given temporal scale (binsize), assumed to be recorded in parallel, the CAD analysis can be applied as demonstrated in this short toy example of 5 parallel spike trains that exhibit fully synchronous events of order 5.
>>> import matplotlib.pyplot as plt
>>> import elephant.conversion as conv
>>> import elephant.spike_train_generation
>>> import quantities as pq
>>> import numpy as np
>>> import elephant.cell_assembly_detection as cad
>>> np.random.seed(30)
>>> # Generate correlated data and bin it with a binsize of 10ms
>>> sts = elephant.spike_train_generation.cpp(
>>> rate=15*pq.Hz, A=[0]+[0.95]+[0]*4+[0.05], t_stop=10*pq.s)
>>> binsize = 10*pq.ms
>>> spM = conv.BinnedSpikeTrain(sts, binsize=binsize)
>>> # Call of the method
>>> patterns = cad.cell_assembly_detection(spM=spM, maxlag=2)[0]
>>> # Plotting
>>> plt.figure()
>>> for neu in patterns['neurons']:
>>> if neu == 0:
>>> plt.plot(
>>> patterns['times']*binsize, [neu]*len(patterns['times']),
>>> 'ro', label='pattern')
>>> else:
>>> plt.plot(
>>> patterns['times']*binsize, [neu] * len(patterns['times']),
>>> 'ro')
>>> # Raster plot of the data
>>> for st_idx, st in enumerate(sts):
>>> if st_idx == 0:
>>> plt.plot(st.rescale(pq.ms), [st_idx] * len(st), 'k.',
>>> label='spikes')
>>> else:
>>> plt.plot(st.rescale(pq.ms), [st_idx] * len(st), 'k.')
>>> plt.ylim([-1, len(sts)])
>>> plt.xlabel('time (ms)')
>>> plt.ylabel('neurons ids')
>>> plt.legend()
>>> plt.show()
[1] Russo, E., & Durstewitz, D. (2017). Cell assemblies at multiple time scales with arbitrary lag constellations. Elife, 6.
elephant.cell_assembly_detection.
cell_assembly_detection
(data, maxlag, reference_lag=2, alpha=0.05, min_occ=1, size_chunks=100, max_spikes=inf, significance_pruning=True, subgroup_pruning=True, same_config_cut=False, bool_times_format=False, verbose=False)[source]¶The function performs the CAD analysis for the binned (discretized) spike trains given in input. The method looks for candidate significant patterns with lags (number of bins between successive spikes in the pattern) going from -maxlag and maxlag (second parameter of the function). Thus, between two successive spikes in the pattern there can be at most maxlag`*`binsize units of time.
The method agglomerates pairs of units (or a unit and a preexisting assembly), tests their significance by a statistical test and stops when the detected assemblies reach their maximal dimension (parameter max_spikes).
At every agglomeration size step (ex. from triplets to quadruplets), the method filters patterns having the same neurons involved, and keeps only the most significant one. This pruning is optional and the choice is identified by the parameter ‘significance_pruning’. Assemblies already included in a bigger assembly are eliminated in a final pruning step. Also this pruning is optional, and the choice is identified by the parameter subgroup_pruning.
Parameters: | data : BinnedSpikeTrain object
maxlag: int
reference_lag : int
alpha : float
min_occ : int
size_chunks : int
max_spikes : int
significance_pruning : bool
subgroup_pruning : bool
same_config_cut: bool
bool_times_format: bool
verbose: bool
|
---|---|
Returns: | assembly_bin : list
|
Raises: | TypeError
ValueError
Examples ——- >>> import elephant.conversion as conv >>> import elephant.spike_train_generation >>> import quantities as pq >>> import numpy as np >>> import elephant.cell_assembly_detection as cad >>> np.random.seed(30) >>> # Generate correlated data and bin it with a binsize of 10ms >>> sts = elephant.spike_train_generation.cpp( >>> rate=15*pq.Hz, A=[0]+[0.95]+[0]*4+[0.05], t_stop=10*pq.s) >>> binsize = 10*pq.ms >>> spM = conv.BinnedSpikeTrain(sts, binsize=binsize) >>> # Call of the method >>> patterns = cad.cell_assembly_detection(spM=spM, maxlag=2)[0] |
References
[1] Russo, E., & Durstewitz, D. (2017). Cell assemblies at multiple time scales with arbitrary lag constellations. Elife, 6.