meeg_utils.Dataset#

class meeg_utils.Dataset(root, *, datatype=None, subjects=None, sessions=None, tasks=None, runs=None, exclude=())[source]#

The MEG/EEG recordings of a BIDS dataset, selected by entity.

Parameters:
  • root (str | Path) – Root of the BIDS dataset.

  • datatype ({"meg", "eeg"} | None) – Keep only this datatype.

  • subjects (list of str | None) – Keep only these labels (without the sub- etc. prefixes). Empty-room recordings (sub-emptyroom) are left out unless "emptyroom" is listed.

  • sessions (list of str | None) – Keep only these labels (without the sub- etc. prefixes). Empty-room recordings (sub-emptyroom) are left out unless "emptyroom" is listed.

  • tasks (list of str | None) – Keep only these labels (without the sub- etc. prefixes). Empty-room recordings (sub-emptyroom) are left out unless "emptyroom" is listed.

  • runs (list of str | None) – Keep only these labels (without the sub- etc. prefixes). Empty-room recordings (sub-emptyroom) are left out unless "emptyroom" is listed.

  • exclude (list of str) – Recordings to leave out: any whose file name contains one of these strings (e.g. ["sub-07", "task-rest_run-02"]).

recordings#

The selected recordings, sorted.

Type:

list of BIDSPath

Examples

>>> ds = meu.Dataset("/data/bids", datatype="meg", tasks=["faces"])
>>> ds.groups()
{'sub-01_ses-01_task-faces_meg': [BIDSPath(...run-01...), BIDSPath(...run-02...)], ...}
__init__(root, *, datatype=None, subjects=None, sessions=None, tasks=None, runs=None, exclude=())[source]#

Methods

__init__(root, *[, datatype, subjects, ...])

groups()

Group the recordings that belong together: the runs of one session and task.

table()

One row per recording with its BIDS entities and file.

groups()[source]#

Group the recordings that belong together: the runs of one session and task.

Returns:

Group name (the file name without the run) mapped to its recordings, in run order.

Return type:

dict

table()[source]#

One row per recording with its BIDS entities and file.

Returns:

subject, session, task, acquisition, run, datatype, group and path.

Return type:

list of dict

__len__()[source]#

Return the number of recordings.

__iter__()[source]#

Iterate over the recordings.

__repr__()[source]#

Summarize the selection.