Skip to content

Cell assemblies detection: cicada_tools.cell_assemblies

from cicada_analysis.cicada_tools.cell_assemblies.<module> import <function>

Assembly detection from calcium imaging data (Malvache et al. 2016) via SCE-based k-means clustering (built on cicada_tools.clustering and pairwise_cell_similarity).


cell_assemblies.malvache.utils_malvache_assemblies (Main pipeline)

Used by the cicada_assemblies_malvache_analysis plugin:

  • compute_and_plot_clusters_raster_kmean_version

compute_and_plot_clusters_raster_kmean_version(labels, activity_threshold, range_n_clusters_k_mean, n_surrogate_k_mean, spike_nums_to_use, cellsinpeak, data_descr, path_results, sliding_window_duration, sce_times_numbers, SCE_times, perc_threshold, n_surrogate_activity_threshold, ...)

Top-level entry point: runs clustering + statistical validation, then plots + saves cell-assembly figures/data.

Parameter Type Description
labels list Cell labels
activity_threshold float Activity threshold
range_n_clusters_k_mean list Range of cluster numbers to try
n_surrogate_k_mean int Number of surrogate tests
spike_nums_to_use list Spike numbers to use
cellsinpeak list Cells in peak
data_descr str Data description
path_results str Results path
sliding_window_duration float Sliding window duration
sce_times_numbers list SCE times
SCE_times list SCE times
perc_threshold float Percentile threshold
n_surrogate_activity_threshold int Number of surrogate activity thresholds

Returns: None

  • compute_kmean

compute_kmean(neurons_labels, cellsinpeak, n_surrogate, range_n_clusters, path_results, sliding_window_duration, SCE_times, data_id, ...)

Runs clusters_on_sce_from_covnorm + statistical_cell_assemblies_def across candidate cluster counts.

Parameter Type Description
neurons_labels list Neuron labels
cellsinpeak list Cells in peak
n_surrogate int Number of surrogates
range_n_clusters list Range of cluster numbers
path_results str Results path
sliding_window_duration float Sliding window duration
SCE_times list SCE times
data_id str Data ID

Returns: tuple | None — Clustering results or None

  • CellAssembliesStruct

CellAssembliesStruct(cellsinpeak, n_clusters, sce_clusters_id, sce_clusters_labels, neurons_labels, cluster_with_best_silhouette_score, path_results, sliding_window_duration, n_surrogate_k_mean, SCE_times, data_id)

Class. Container for one clustering result, built by compute_kmean; plot_cell_assemblies(...) draws the assembly-ordered raster + cells-vs-SCE heatmap; save_data_on_file(...) / load_cell_assemblies_data(...) round-trip results to/from disk.

  • statistical_cell_assemblies_def

statistical_cell_assemblies_def(cell_assemblies_struct, n_surrogate=1000, debug_mode=False)

In-place statistical validation (Bonferroni-corrected surrogate test) of cell-assembly membership.

Parameter Type Default Description
cell_assemblies_struct CellAssembliesStruct Cell assemblies structure
n_surrogate int 1000 Number of surrogates
debug_mode bool False Debug output

Returns: None