Code accompanying Leupin and Britz, PNAS (2024) We here provide the code for preprocessing, epoching, and analysis of EEG data in sensor and source space. EEG data can be made available upon request.
Each folder is generally organized with a main, helper and constants script.The base folder contains some helper functions to filter through the data directories.
- The main scripts contain the code that must be run.
- The helper scripts contain the helper functions and classes used to run the code.
- The constant files contain constants that are called in the script.
- markers/markers_main.py
- epochs/epochs_main.py
- ICA
- evoked/autoreject_main.py
- evoked/evoked_MNE_main.py
- source/compute_fwd_solution.ipynb
- source/source_main.py
- markers: analyzes cardiac and respiratory signals and generates markers to classify each stimulus according to the behavioral response and the cardiac / respiratory phase.
- epochs: segments the EEG into epochs before artifact rejection and computes ICA solutions.
- ICA: jupyter notebook to be applied to each subject to manually select ICA components to be rejected.
- evoked:
- autoreject: used the Autoreject procedure to clean the epoched data after the ICA.
- evoked_MNE: computes evoked potentials for each condition and each subject.
- source:
- compute_fwd_solution: jupyter notebook to compute the forward solution (requires manual coregistration of electrodes).
- source_main: applies inverse solution of the forward model to ERPs to compute sources for each condition and each subject.
The stats folder contains the code for statistical analyses.
- Behavioral_GLM.Rmd: R markdown script to run the General Linear Mixed Models.
- Behav_rev.ipynb: jupyter notebook to compute descriptive statistics and code to generate figures.
- Sensor_space_stats.ipynb: jupyter notebook that contains all analysis and figure output for the ERP analyses.
- Stats_helper contains helper functions used in sensor_space_stats.ipynb.
- Source_statistics.ipynb: jupyter notebook that contains all analysis and figure output for the source space analyses.
- Inverse_stats_helper.py contains helper functions used in source_statistics.ipynb.