dirconn.read_bids#

dirconn.read_bids(root: str | PathLike[str], *, subject: str, task: str, session: str | None = None, run: int | str | None = None, datatype: str | None = None, level: str = 'sensor', description: str | None = None, nan: str = 'raise', bad_annotations: str = 'ignore') → TimeSeries#

Read one recording from a BIDS dataset as a TimeSeries.

Parameters:
  • root (path-like) – Root of the BIDS dataset, or of the derivatives dataset when level="roi".

  • subject (str) – BIDS entities.

  • task (str) – BIDS entities.

  • session (optional) – BIDS entities.

  • run (optional) – BIDS entities.

  • datatype ({"eeg", "meg", "ieeg"}, optional) – Inferred from the directory when only one exists.

  • level ({"sensor", "roi"}) – "sensor" reads a standard raw BIDS recording through mne-bids. "roi" reads a dataset written with write_roi_bids() and requires the Dirconn convention entry.

  • description (str, optional) – The desc entity; required for level="roi".

  • nan ({"raise", "mask"}) – What to do with NaN samples, as in TimeSeries.from_array(): "mask" replaces them by 0 and marks them invalid in TimeSeries.valid (gaps in the recording).

  • bad_annotations ({"ignore", "mask"}) – Sensor level only: "mask" also marks samples under BAD_ annotations invalid (needs nan="mask"). Ignored for level="roi", where invalid samples are stored as NaN.

Return type:

TimeSeries