mne_bids.get_entities_from_fname#
- mne_bids.get_entities_from_fname(fname, on_error='raise', verbose=None)[source]#
Retrieve a dictionary of BIDS entities from a filename.
Entities not present in
fnamewill be assigned the value ofNone.- Parameters:
- fname
BIDSPath| path-like The path to parse.
- on_error‘raise’ | ‘warn’ | ‘ignore’
If any unsupported labels in the filename are found and this is set to
'raise', raise aRuntimeError. If'warn', emit a warning and continue, and if'ignore', neither raise an exception nor a warning, and return all entities found. For example, currently MNE-BIDS does not support derivatives yet, but thedescentity label is used to differentiate different derivatives and will work with this function ifon_error='ignore'.- verbose
bool|str|int|None Control verbosity of the logging output. If
None, use the default verbosity level. See the logging documentation andmne.verbose()for details. Should only be passed as a keyword argument.
- fname
- Returns:
- params
dict A dictionary with the keys corresponding to the BIDS entity names, and the values to the entity values encoded in the filename.
- params
Examples
>>> fname = 'sub-01_ses-exp_run-02_meg.fif' >>> get_entities_from_fname(fname) {'subject': '01', 'session': 'exp', 'task': None, 'acquisition': None, 'run': '02', 'processing': None, 'space': None, 'recording': None, 'split': None, 'description': None}