mne_bids.get_entities_from_fname¶
- 
mne_bids.get_entities_from_fname(fname, on_error='raise')[source]¶ Retrieve a dictionary of BIDS entities from a filename.
Entities not present in
fnamewill be assigned the value ofNone.- Parameters
 - fnameBIDSPath | str
 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'.
- Returns
 - paramsdict
 A dictionary with the keys corresponding to the BIDS entity names, and the values to the entity values encoded in the filename.
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, 'suffix': 'meg'}