Mne Bids - Pipeline

pip install mne mne-bids pybv from pathlib import Path import mne from mne_bids import BIDSPath, write_raw_bids, make_dataset_description Define your project root bids_root = Path('/path/to/your/bids_dataset') bids_root.mkdir(exist_ok=True) Create a dataset description (required for BIDS) make_dataset_description( path=bids_root, name="My MEG/EEG Study", authors=["Your Name", "Collaborator"], dataset_doi="", funding="Grant #", ) Define a subject and session subject_id = '001' session_id = '01' # optional task = 'visual' Convert a single raw file (e.g., BrainVision .vhdr) raw_path = Path('/raw_data/sub-001/session_1/eeg.vhdr') bids_path = BIDSPath( subject=subject_id, session=session_id, task=task, suffix='eeg', root=bids_root, ) Write to BIDS (copies and anonymizes) raw = mne.io.read_raw_brainvision(raw_path, preload=False) write_raw_bids( raw, bids_path, overwrite=False, verbose=True, )

Run in parallel:

from mne_bids import read_raw_bids bids_path = BIDSPath( subject='001', session='01', task='visual', suffix='eeg', root=bids_root, ) mne bids pipeline

For group analysis, save evoked data in BIDS-derivatives: pip install mne mne-bids pybv from pathlib import