mne.merge_events#

mne.merge_events(events, ids, new_id, replace_events=True)[source]#

Merge a set of events.

Parameters:
eventsarray, shape (n_events_in, 3)

Events.

idsarray of int

The ids of events to merge.

new_idint

The new id.

replace_eventsbool

If True (default), old event ids are replaced. Otherwise, new events will be added to the old event list.

Returns:
new_eventsarray, shape (n_events_out, 3)

The new events.

Notes

Rather than merging events you can use hierarchical event_id in Epochs. For example, here:

>>> event_id = {'auditory/left': 1, 'auditory/right': 2}

And the condition ‘auditory’ would correspond to either 1 or 2.

Examples

Here is quick example of the behavior:

>>> events = [[134, 0, 1], [341, 0, 2], [502, 0, 3]]
>>> merge_events(events, [1, 2], 12, replace_events=True)
array([[134,   0,  12],
       [341,   0,  12],
       [502,   0,   3]])
>>> merge_events(events, [1, 2], 12, replace_events=False)
array([[134,   0,   1],
       [134,   0,  12],
       [341,   0,   2],
       [341,   0,  12],
       [502,   0,   3]])

Examples using mne.merge_events#

Working with events

Working with events

Regression-based baseline correction

Regression-based baseline correction