mne_rt.tools.save_as_bids#
- mne_rt.tools.save_as_bids(raw: BaseRaw, nf_data: dict, output_dir: str | Path, subject: str, session: str | None = None, task: str = 'neurofeedback', run: str | None = None, overwrite: bool = False, verbose: bool | str | None = None) Path[source]#
Save a neurofeedback session in BIDS format.
Writes the raw EEG recording as a BIDS EEG dataset and exports the per-window NF feature time-series as a
*_beh.tsvbehavioural side-car file.- Parameters:
- raw
mne.io.BaseRaw The raw EEG (or MEG) recording to export.
- nf_data
dict Dictionary mapping modality name → list of per-window values (as returned by
record_main()).- output_dir
str|Path Root BIDS directory (created if it does not exist).
- subject
str BIDS subject label (without the
sub-prefix).- session
str|None, defaultNone BIDS session label (without the
ses-prefix).Noneomits the session level.- task
str, default “neurofeedback” BIDS task label.
- run
str|None, defaultNone BIDS run label (without the
run-prefix).- overwritebool, default
False Overwrite existing files.
- verbosebool |
str|None, defaultNone Verbosity passed to mne-bids.
- raw
- Returns:
- bids_path
Path Root BIDS output directory.
- bids_path
- Raises:
FileExistsErrorIf
overwrite=Falseand output files already exist.
Notes
If
mne_bidsis installed (pip install mne-bids) it is used for writing the EEG data with full BIDS compliance. Otherwise a minimal BIDS-like layout is written manually (EEG as.fif, NF data as_beh.tsv, and stubdataset_description.json/participants.tsvfiles).Added in version 1.0.0.