mne_bids.find_matching_paths#

mne_bids.find_matching_paths(root, subjects=None, sessions=None, tasks=None, acquisitions=None, runs=None, processings=None, recordings=None, spaces=None, splits=None, descriptions=None, *, tracking_systems=None, entities=None, suffixes=None, extensions=None, datatypes=None, check=False, ignore_json=False, ignore_nosub=False, fnames=None)[source]#

Get list of all matching paths for all matching entity values.

Input can be str or list of str. None matches all found values.

Performs a recursive search, starting in .root (if set), based on BIDSPath.entities object.

Parameters:
rootpathlib.Path | str

The root of the BIDS path.

subjectsstr | array_like of str | None

The subject ID. Corresponds to “sub”.

sessionsstr | array_like of str | None

The acquisition session. Corresponds to “ses”.

tasksstr | array_like of str | None

The experimental task. Corresponds to “task”.

acquisitionsstr | array_like of str | None

The acquisition parameters. Corresponds to “acq”.

runsstr | array_like of str | None

The run number. Corresponds to “run”.

processingsstr | array_like of str | None

The processing label. Corresponds to “proc”.

recordingsstr | array_like of str | None

The recording name. Corresponds to “recording”.

spacesstr | array_like of str | None

The coordinate space for anatomical and sensor location files (e.g., *_electrodes.tsv, *_markers.mrk). Corresponds to “space”. Note that valid values for space must come from a list of BIDS keywords as described in the BIDS specification.

splitsstr | array_like of str | None

The split of the continuous recording file for .fif data. Corresponds to “split”.

descriptionsstr | array_like of str | None

This corresponds to the BIDS entity desc. It is used to provide additional information for derivative data, e.g., preprocessed data may be assigned description='cleaned'.

Added in version 0.11.

tracking_systemsstr | array_like of str | None

The motion tracking system labels to match for Motion-BIDS data. These correspond to the BIDS entity tracksys. For example, tracking_systems="omcA" matches filenames containing tracksys-omcA.

Added in version 0.19.

entitiesdict | None

The values to match for the BIDS entities that have no keyword argument of their own, by entity name (as in mne_bids.BIDSPath.entities). For example, entities={"echo": "1"} matches filenames containing echo-1, and entities={"reconstruction": ["norm", "raw"]} those containing rec-norm or rec-raw. Each value can be a str, an array-like of str, or None.

Added in version 0.21.

suffixesstr | array_like of str | None

The filename suffix. This is the entity after the last _ before the extension. E.g., 'channels'. The following filename suffix’s are accepted: ‘meg’, ‘markers’, ‘eeg’, ‘ieeg’, ‘T1w’, ‘participants’, ‘scans’, ‘electrodes’, ‘coordsystem’, ‘channels’, ‘events’, ‘headshape’, ‘digitizer’, ‘beh’, ‘physio’, ‘stim’.

extensionsstr | array_like of str | None

The extension of the filename. E.g., '.json'.

datatypesstr | array_like of str | None

The BIDS data type, e.g., 'anat', 'func', 'eeg', 'meg', 'ieeg'.

checkbool

If True, only returns paths that conform to BIDS. If False (default), the .check attribute of the returned mne_bids.BIDSPath object will be set to True for paths that do conform to BIDS, and to False for those that don’t.

ignore_jsonbool

If True, ignores json files. Defaults to False.

ignore_nosubbool

If True, ignores all files that are not of the form root/sub-*. Defaults to False.

fnamesiterable of path-like | None

File paths to filter instead of listing the files in root, for example the members of an archive or the listing of a remote dataset. Each path must be inside root or relative to it, and is not checked for existence. The returned BIDSPath objects are root joined with these paths. URLs are not accepted: pass the part after the dataset root, for example "sub-01/eeg/sub-01_task-rest_eeg.edf".

Added in version 0.21.

Returns:
bids_pathslist of mne_bids.BIDSPath

The matching paths.

Examples using mne_bids.find_matching_paths#

Read BIDS datasets

Read BIDS datasets

Updating BIDS datasets

Updating BIDS datasets