dirconn.write_roi_bids#
- dirconn.write_roi_bids(ts: TimeSeries, root: str | PathLike[str], *, subject: str, task: str, description: str, session: str | None = None, run: int | str | None = None, datatype: str = 'eeg', source_space: str | None = None, inverse_method: str | None = None, roi_extraction: str | None = None, source_orientation: str | None = None, leakage_correction: str | None = None, overwrite: bool = False) Any#
Write region-level time series as a BIDS-Derivatives dataset (dirconn convention v0).
The data are stored as a double-precision FIF file. Epoched data are concatenated along time and described by an
events.tsvfile plus theSegmentation,NTrials,EpochLengthandTminentries of the sidecar, so they can be restored exactly. Channel positions are not stored. Invalid samples (ts.valid) are written as NaN; read them back withread_bids(..., nan="mask"). Apredictmask is an analysis choice, not part of the recording, and is not written: such series are refused.- Parameters:
ts (TimeSeries) – Region-level series; the channel metadata (region, hemisphere, atlas, node kind) is written to
channels.tsv.root (path-like) – Root of the derivatives dataset; created if needed.
subject (str) – BIDS entities.
task (str) – BIDS entities.
description (str) – Value of the
descentity, which is mandatory for derivatives (for example"dk").session (optional) – BIDS entities.
run (optional) – BIDS entities.
datatype ({"eeg", "meg", "ieeg"}) – Directory and suffix to use, normally the modality the regions were reconstructed from.
source_space (str) – Processing description recorded in the
Dirconnsidecar entry; omitted whenNone.inverse_method (str) – Processing description recorded in the
Dirconnsidecar entry; omitted whenNone.roi_extraction (str) – Processing description recorded in the
Dirconnsidecar entry; omitted whenNone.source_orientation (str) – Processing description recorded in the
Dirconnsidecar entry; omitted whenNone.leakage_correction (str) – Processing description recorded in the
Dirconnsidecar entry; omitted whenNone.overwrite (bool) – Replace existing files instead of raising
FileExistsError.
- Returns:
Path of the FIF file.
- Return type:
mne_bids.BIDSPath