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 Ch01, and an unnamed .h5 or .mat one has no labels at all.

Sampling frequency

The Result’s rate.

Events

The markers, as annotations; the event codes become the trial_type column.

Recording date

result.start_time where the source recorded one; set it on the Raw with set_meas_date, or None.

Manufacturer, device

Add Manufacturer: g.tec medical engineering and the model to the _eeg.json sidecar yourself; the device serial is in the recording’s gpype_meta and in an EDF file’s equipment field, where the source recorded one.

Power line frequency

Yours, raw.info["line_freq"].

Subject, session, task, run

Yours, in the BIDSPath.

Reference, electrode positions

Yours: the reference scheme in the sidecar, positions through an MNE montage, set_montage, which mne-bids writes as _electrodes.tsv.

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.