bemobil_mne.io.export_to_bids#

bemobil_mne.io.export_to_bids(raw, bids_root, subject, session=None, task='task', run=None, acquisition=None, events=None, event_id=None, line_freq=50.0, overwrite=False, verbose=True, extra_params=None)[source]#

Export an MNE Raw object to a BIDS-compatible directory tree.

Wraps mne_bids.write_raw_bids() with sensible defaults for EEG data and records the BIDS path in the raw object’s provenance descriptor (when one exists).

Parameters:
rawmne.io.BaseRaw

Raw EEG recording. Must have a montage set and info['sfreq'] populated.

bids_rootstr | Path

Root of the BIDS dataset (will be created if it does not exist).

subjectstr

BIDS subject label (without the sub- prefix, e.g. "01").

sessionstr | None

BIDS session label (without ses-). None omits the session directory level.

taskstr

BIDS task label. Defaults to "task".

runstr | None

BIDS run label (without run-). None when there is a single run.

acquisitionstr | None

BIDS acquisition label (without acq-).

eventsndarray, shape (n_events, 3) | None

MNE-style event array (sample, prev_id, event_id). When None, events are derived from raw.annotations automatically by mne_bids.write_raw_bids().

event_iddict | None

Mapping of event descriptions to integer codes, e.g. {"left_hand": 1, "right_hand": 2}.

line_freqfloat

Power-line frequency (Hz). Used to populate the PowerLineFrequency BIDS field. Defaults to 50 Hz (Europe / most of Asia).

overwritebool

Whether to overwrite existing BIDS files for this entity.

verbosebool | str | int

Verbosity level forwarded to mne_bids.write_raw_bids().

extra_paramsdict | None

Extra keyword arguments forwarded verbatim to mne_bids.write_raw_bids().

Returns:
bids_pathmne_bids.BIDSPath

The mne_bids.BIDSPath object describing the written file.