A comprehensive Python package for EEG, eye-tracking, and behavioral data analysis, built on top of MNE-Python. open_dvm covers the full pipeline from raw-data preprocessing through ERP analysis, time-frequency decomposition, multivariate decoding, and spatial encoding models -- especially suited to integrating EEG data with behavioral and/or eye-tracking experiments (e.g. via OpenSesame).
EEG analysis includes:
- Semi-automatic preprocessing pipeline (filtering, ICA, artifact rejection)
- ERP analysis
- Time-frequency decomposition
- Multivariate decoding (BDM)
- Forward encoding / channel tuning function models (CTF)
- Eye-tracking integration and quality control
Full documentation, including runnable tutorials with real output, is at open-dvm.readthedocs.io.
pip install open-dvmFor development (editable install with test/lint dependencies):
git clone https://github.com/dvanmoorselaar/open_dvm.git
cd open_dvm
pip install -e ".[dev]"from open_dvm.analysis import ERP
from open_dvm.support import FolderStructure
# Load preprocessed data
df, epochs = FolderStructure().load_processed_epochs(sj=1, fname='ses_01_main', preproc_name='main')
# Compute condition-specific ERPs
erp = ERP(sj=1, epochs=epochs, df=df, baseline=(-0.2, 0))
erp.condition_erps(pos_labels={'target_loc': [2, 6]})The tutorials/ folder contains 10 Jupyter notebooks that walk through the toolbox end to end, from preprocessing to advanced decoding. For rendered versions with real output already included, see the hosted tutorials.
How they fit together:
- 00 uses synthetic, on-the-fly generated data with deliberately strong, guaranteed-significant effects -- a safe, fast playground for learning the plotting/statistics API before touching real data. Start here.
- 01 preprocesses raw EEG into the epoched format every other tutorial reads. It requires interactive ICA component selection, so it can't run headless -- but you can skip it entirely: every other tutorial auto-downloads an already-preprocessed example dataset the first time it runs.
- 02 through 09 all analyze that same example dataset (not different datasets per tutorial) -- each one just picks whichever subject best illustrates its particular analysis method, so you'll see
sj = 1in some andsj = 2in others. Each covers one analysis module (ERP, TFR, BDM, or CTF) end to end, so they can be read in any order once you've done 00.
| Notebook | Description |
|---|---|
| 00_visualization_and_statistics | Tour of every plotting/statistics option in open_dvm.visualization.plot, using synthetic data with guaranteed-significant effects. Read this one first. |
| 01_preprocessing | EEG preprocessing pipeline: filtering, ICA, artifact rejection |
| 02_erp_analysis | Event-related potential (ERP) computation and visualization |
| 03_tfr_analysis | Time-frequency decomposition via Morlet wavelets |
| 04_tfr_advanced | Advanced TFR: wavelet parameters, alternative decompositions, group-level stats |
| 05_bdm_decoding | Multivariate decoding (BDM) basics: localizer/main-task decoding, cross-task generalization |
| 06_bdm_advanced | Advanced BDM: temporal generalization, classifier comparisons, time-frequency decoding |
| 07_ctf_analysis | Spatial channel tuning functions (CTF) via an inverted encoding model |
| 08_ctf_advanced | Advanced CTF: homogeneous ("ping") displays, subject-specific reference-location alignment |
| 09_bdm_ctf_comparison | BDM vs. CTF side by side on the same question -- decodability vs. interpretability |
Analyses are run from project-specific scripts, pointed at a project folder containing:
eeg/raw(raw EEG files --.bdf(BioSemi),.edf, BrainVision.vhdr, Neuroscan.cnt, or EEGLAB.set; pass the extension viaeeg_preprocessing_pipeline'sraw_extparameter, default'bdf')..bdf/.edfcarry trigger info on a dedicated stim channel;.vhdr/.cnt/.setrepresent it as annotations instead, so also passannotation_event_id(a dict mapping your file's annotation descriptions to the same integer codes your behavioral file uses -- seeRAW.select_events's docstring).behavioral/raw(raw behavior files,.csv)eye/raw(raw eye-tracking files, if available:.ascor.csv)
For detailed file naming conventions and folder organization standards, see NAMING_CONVENTIONS.md.
See KNOWN_LIMITATIONS.md for a list of known gaps, deferred features, and open methodological questions.
Contributions are welcome -- see CONTRIBUTING.md for dev setup, running tests, and the PR process.
If you use open_dvm, please cite it via CITATION.cff (or GitHub's "Cite this repository" button). The accompanying methods paper is still in preparation; the citation entry will be updated with full details once it's available.
This toolbox is built on MNE-Python -- please also cite:
Gramfort, A., Luessi, M., Larson, E., Engemann, D. A., Strohmeier, D., Brodbeck, C., ... & Hämäläinen, M. S. (2014). MNE software for processing MEG and EEG data. Neuroimage, 86, 446-460.
Please open a GitHub issue, or contact Dirk van Moorselaar at dirkvanmoorselaar@gmail.com.