elephant.cell_assembly_detection.cell_assembly_detection

elephant.cell_assembly_detection.cell_assembly_detection(binned_spiketrain, max_lag, reference_lag=2, alpha=0.05, min_occurrences=1, size_chunks=100, max_spikes=inf, significance_pruning=True, subgroup_pruning=True, same_configuration_pruning=False, verbose=False)[source]

Perform the CAD analysis (Russo and Durstewitz, 2017) for the binned (discretized) spike trains given in the input. The method looks for candidate significant patterns with lags (number of bins between successive spikes in the pattern) ranging from -max_lag to max_lag (the second parameter of the function). Thus, between two successive spikes in the pattern there can be at most max_lag`*`bin_size 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 (e.g. 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:
binned_spiketrainelephant.conversion.BinnedSpikeTrain

Binned spike trains containing data to be analyzed.

max_lagint

Maximal lag to be tested. For a binning dimension of bin_size the method will test all pairs configurations with a time shift between ‘-max_lag’ and ‘max_lag’.

reference_lagint, optional

Reference lag (in bins) for the non-stationarity correction in the statistical test. Default: 2

alphafloat, optional

Significance level for the statistical test. Default: 0.05

min_occurrencesint, optional

Minimal number of occurrences required for an assembly (all assemblies, even if significant, with fewer occurrences than min_occurrences are discarded). Default: 0

size_chunksint, optional

Size (in bins) of chunks in which the spike trains are divided to compute the variance (to reduce non stationarity effects on variance estimation). Default: 100

max_spikesint, optional

Maximal assembly order (the algorithm will return assemblies composed of maximum max_spikes elements). Default: np.inf

significance_pruningbool, optional

If True, the method performs significance pruning among the detected assemblies. Default: True

subgroup_pruningbool, optional

If True, the method performs subgroup pruning among the detected assemblies. Default: True

same_configuration_pruningbool, optional

If True, performs pruning (not present in the original code and more efficient), not testing assemblies already formed if they appear in the very same configuration. Default: False

verbosebool, optional

Regulates the number of prints given by the method. If true all prints are given, otherwise the method does give any prints. Default: False

Returns:
assemblylist of dict

Contains the assemblies detected for the bin size chosen. Each assembly is a dictionary with attributes:

‘neurons’list

Vector of units taking part to the assembly (unit order correspond to the agglomeration order).

‘lag’pq.Quantity

Vector of time lags. lag[z] is the activation delay between neurons[1] and neurons[z+1].

‘pvalue’list

Vector containing p-values. pvalue[z] is the p-value of the statistical test between performed adding neurons[z+1] to the neurons[1:z].

‘times’pq.Quantity

Assembly activation times in the units of binned_spiketrain.

‘signature’np.ndarray

Array of two entries (z,c). The first is the number of neurons participating in the assembly (size), and the second is number of assembly occurrences.

Raises:
TypeError

If binned_spiketrain is not an instance of elephant.conversion.BinnedSpikeTrain.

ValueError

If the parameters are out of bounds.

Notes

Alias: cad