Search a collection of event names for matching (sub-)groups of events.
This function is particularly helpful when using grouped event names
(i.e., event names containing forward slashes /
). Please see the
Examples section below for a working example.
str
| dict
Either a collection of event names, or the event_id
dictionary
mapping event names to event codes.
str
| str
One or multiple event names or groups to search for in event_names
.
How to handle situations when none of the keys
can be found in
event_names
. If 'warn'
or 'ignore'
, an empty list will be
returned.
Notes
New in version 1.0.
Examples
Assuming the following grouped event names in the data, you could easily
query for all auditory
and left
event names:
>>> event_names = [
... 'auditory/left',
... 'auditory/right',
... 'visual/left',
... 'visual/right'
... ]
>>> match_event_names(
... event_names=event_names,
... keys=['auditory', 'left']
... )
['auditory/left', 'auditory/right', 'visual/left']