Convert an event array to an Annotations object.
ndarray
, shape (n_events, 3)The events.
float
Sampling frequency.
dict
| array-like | callable()
| None
Events description. Can be:
dict: map integer event codes (keys) to descriptions (values). Only the descriptions present will be mapped, others will be ignored.
array-like: list, or 1d array of integers event codes to include. Only the event codes present will be mapped, others will be ignored. Event codes will be passed as string descriptions.
callable: must take a integer event code as input and return a string description or None to ignore it.
None: Use integer event codes as descriptions.
int
The first data sample (default=0). See mne.io.Raw.first_samp
docstring.
float
| str
| datetime
| tuple
of int
| None
Determines the starting time of annotation acquisition. If None
(default), starting time is determined from beginning of raw data
acquisition. For details, see mne.Annotations()
docstring.
str
| int
| None
Control verbosity of the logging output. If None
, use the default
verbosity level. See the logging documentation and
mne.verbose()
for details. Should only be passed as a keyword
argument.
Annotations
The annotations.
See also
Notes
Annotations returned by this function will all have zero (null) duration.
Creating events from annotations via the function
mne.events_from_annotations
takes in event mappings with
key→value pairs as description→ID, whereas mne.annotations_from_events
takes in event mappings with key→value pairs as ID→description.
If you need to use these together, you can invert the mapping by doing:
event_desc = {v: k for k, v in event_id.items()}
mne.annotations_from_events
#