mne_bids.utils.get_entity_vals

mne_bids.utils.get_entity_vals(bids_root, entity_key)[source]

Get list of values associated with an entity_key in a BIDS dataset.

BIDS file names are organized by key-value pairs called “entities” [1]. With this function, you can get all values for an entity indexed by its key.

Parameters
bids_rootstr | pathlib.Path

Path to the root of the BIDS directory.

entity_keystr

The name of the entity key to search for. Can be one of [‘sub’, ‘ses’, ‘run’, ‘acq’].

Returns
entity_valslist of str

List of the values associated with an entity_key in the BIDS dataset pointed to by bids_root.

References

1

https://bids-specification.rtfd.io/en/latest/02-common-principles.html#file-name-structure # noqa: E501

Examples

>>> bids_root = '~/bids_datasets/eeg_matchingpennies'
>>> entity_key = 'sub'
>>> get_entity_vals(bids_root, entity_key)
['05', '06', '07', '08', '09', '10', '11']