Code used for the article "Synchrony, oscillations, and phase relationships in collective neuronal activity: a highly-comparative overview of methods" by F. Baroni and B.D. Fulcher (2024). The code is licensed under the GNU GPL v3 license (or later).
Most code is in Matlab. Some functions use tightPosition
for creating figures and hence require a modern version of Matlab (R2022b or newer), but most of the code will run with an older version.
Some of the scripts and functions require the Wavelet Toolbox, the Image Processing Toolbox, or the Statistics and Machine Learning Toolbox, but most of the code will run with a basic Matlab installation.
Some of the scripts and functions require a Python environment recognized by Matlab. In particular, these are the functions that perform FOOOF model estimation, and those that estimate intrinsic dimensionality using DADApy.
This repository includes code for:
- the generation of synthetic spike trains, inside the directory
synth_train_generation
; - the analysis of real and synthetic spike trains, including the generation of all paper figures included in Baroni & Fulcher 2024, inside the directory
data_analysis
.
The README
file includes a description of all high-level scripts and functions. The top-level script script_all.m
includes all scripts required for the generation of synthetic data and for the analysis of synthetic and real spike trains, yielding all the results reported in Baroni & Fulcher 2024 in the same order as presented in the article.
Multiple synthetic spike trains with parameters spanning a range of values can be generated by using one of the scripts named script_*_train_range.m
:
script_sin_train_range.m
- single-scale, non sequential trainsscript_sinseq_train_range.m
- single-scale, sequential trainsscript_G_train_range.m
- dual-scale, non sequential trainsscript_Gseq_train_range.m
- dual-scale, sequential trains
sin
in a script or function name indicates "single-scale" trains (stands for "sinusoidal"). G
in a script or function name indicates "dual-scale" trains (stands for "Gaussian").
Spike train raster plots as in Fig 1 can be generated using plot_sinosc_train.m
.
The MSTM library is included in the functions:
analyze_sinosc_train_ms.m
analyze_sinosc_train_fooof.m
analyze_sinosc_train_synfireind.m
These are called from the scripts script_*_train_range.m
mentioned above, in the "Synthetic Spike Train Generation" section.
The scripts script_all_train_range_ss.m
and script_all_train_range_ds.m
load (single-scale and dual-scale, respectively) synthetic spike train measures and calculate the correlation of each MSTM with each generative parameter, generating panels such as those shown in Fig 3 using the function multi_all_train_range_anal_corr_bal.m
.
The script script_all_train_range.m
loads synthetic spike train measures from both the single-scale and the dual-scale formalisms, and calculates inter-MSTM correlations and the resulting dendrogram, as in Fig 4, using the function multi_all_train_range_anal_bs_cluster_bal.m
.
The scripts script_data_train_{See18,Smith08,Form22}.m
load, preprocess and analyze each of the three spike train datasets considered in this study:
script_data_train_See18.m
for the dataset from See et al. 2018,script_data_train_Smith08.m
for the dataset from Smith et al. 2008,script_data_train_Form22.m
for the dataset from Formozov et al. 2022.
The MSTM library can be applied to the preprocessed spike train datasets by using the functions:
analyze_osc_train_ms_win_{See18,Smith08,data}.m
analyze_osc_train_fooof_win_data.m
analyze_osc_train_synfireind_win_data.m
which recapitulate the corresponding functions used for the synthetic spike train analysis mentioned above in section "Synthetic Spike Train Analysis".
A visualization of each dataset through the lens of the MSTM library, as in Fig 7, can be obtained by using multi_train_anal_win_cluster.m
.
To include additional MSTMs, you can write a new "Synthetic Spike Train Analysis" function following the template provided in the functions indicated above (analyze_sinosc_train_ms.m
, analyze_sinosc_train_fooof.m
or analyze_sinosc_train_synfireind.m
).
Then, you can add a new case in get_field_names.m
(for the extended set of MSTM, including multiple timescales for the timescale-dependent measures) and get_field_names_bs.m
(for the core set of MSTM, including a single timescale---the "best scale"---for the timescale-dependent measures) specifying your new MSTM set. A MSTM set is identified by the field names_string
of the structure par
.
Then, the new selection of measures will be included in subsequent processing (such as clustering analysis, or correlation with generative parameters, etc.).
If you use this code in your project, please cite:
- F. Baroni, B.D. Fulcher (2024). Synchrony, oscillations, and phase relationships in collective neuronal activity: a highly-comparative overview of methods. bioRxiv. doi:10.1101/2024.05.05.592564.
This project welcomes and encourages contributions from the community, and pull requests are appreciated.
To file bug reports and/or ask questions about this project, please use the Github issue tracker.
We include some code developed by others. Please see content of the directory third-party
.
This project was supported by grants PID2021-122347NB-I00 (PI: Pablo Varona Martinez) and PID2020-114867RB-I00 (PI: Francisco de Borja RodrĂguez Ortiz) (MCIN/AEI and ERDF- "A way of making Europe").