Skip to content

Simulates aperiodic EEG signals and detrends EEG spectra, as well as generates figures used in manuscript.

License

Notifications You must be signed in to change notification settings

niklasbrake/EEG_modelling

Repository files navigation

DOI

Paper

This code repository is associated with the following publication:

Brake, N., Duc, F., Rokos, A. et al. A neurophysiological basis for aperiodic EEG and the background spectral trend. Nat Commun 15, 1514 (2024). https://doi.org/10.1038/s41467-024-45922-8

Executing code in this repository

To reproduce the figures, data needs to be downloaded from https://doi.org/10.6084/m9.figshare.24777990. Once this data is downloaded, line 16 of EEG_modelling/model/network_simulation_beluga.m needs to be updated, such that the variable resourceFolder points to the data folder.

If you wish to simulate dipoles, the script EEG_modelling/simulation_examples/example_embedding.m outlines how the model can be simulated. To run this script, the file EEG_modelling/model/compute_tiling_correlation.c needs to be compiled, which can be accomplished with the following command:

gcc compute_tiling_correlation.c -o compute_tiling_correlation.exe -lm -fopenmp

The python packages in requirements.txt need to be installed, which can be accomplished with the following command:

pip install -r requirements.txt

Finally, the .MOD files need to be compiled for the neuron simulator. To do so, navigate to the folder EEG_modelling/model/mod_files and run the command

mknrndll

Detrending EEG spectra

The file EEG_modelling/data_analysis/detrending.py contains the code used to fit Eq. 1, 5, and 6 from the manuscript to EEG spectra. The upper and lower bounds for the various parameters were optimized for our data and may need to be adjusted. EEG_modelling/data_analysis/synDetrend.m is a wrapper to run this function from MATLAB.

Acknowledgements

I completed this work as part of my PhD under the supervision of Dr. Anmar Khadra and in collaboration with Dr. Gilles Plourde at McGill Univeristy. The EEG data used in this project was collected by Dr. Plourde and his team.

License

Creative Commons License
This repository is licensed under a Creative Commons Attribution 4.0 International License.