BIDS Export
g.Pype writes no BIDS dataset itself. The route is the one every Python
EEG tool uses: a Result into an MNE Raw, and mne-bids from
there. pip install mne mne-bids first; the snippet below was run
before it was published.
from mne_bids import BIDSPath, write_raw_bids
raw = to_mne(result) # Season 4, Episode 9's bridge
raw.info["line_freq"] = 50 # mains frequency, BIDS asks for it
raw.set_meas_date(None) # or the session's real date
path = BIDSPath(subject="01", session="01", task="rest", root="my_dataset")
write_raw_bids(raw, path, format="EDF", allow_preload=True, overwrite=True)
That writes my_dataset/ with dataset_description.json,
participants.tsv, and under sub-01/ses-01/eeg/ the recording as
EDF with its _channels.tsv, _eeg.json and _events.tsv, the
events taken from the Raw’s annotations, which are the g.Pype markers.
format="EDF" needs the edfio package; format="BrainVision"
needs pybv.
What comes from g.Pype, and what you add
BIDS field |
Where it comes from |
|---|---|
Channel names, types, units |
The Result: labels, roles and units, as the bridge maps them.
Name the channels at the source, with a Montage or a
ChannelLabeler: a CSV or EDF recording without names reads back
as |
Sampling frequency |
The Result’s rate. |
Events |
The markers, as annotations; the event codes become the
|
Recording date |
|
Manufacturer, device |
Add |
Power line frequency |
Yours, |
Subject, session, task, run |
Yours, in the |
Reference, electrode positions |
Yours: the reference scheme in the sidecar, positions through an
MNE montage, |
A recording that was reprocessed in g.Pype, filtered or re-referenced,
is still a Raw to mne-bids; BIDS asks you to say so in the sidecar’s
SoftwareFilters. MNE-Python Workflow has the
bridge and the EDF route.