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
fname
will be assigned the value ofNone
.- Parameters
- fname
mne_bids.BIDSPath
|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 thedesc
entity label is used to differentiate different derivatives and will work with this function ifon_error='ignore'
.
- 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, 'suffix': 'meg'}