mne.count_events#

mne.count_events(events, ids=None)[source]#

Count events.

Parameters:
eventsndarray, shape (N, 3)

The events array (consisting of N events).

idsarray_like of int | None

If None, count all event types present in the input. If array-like of int, count only those event types given by ids.

Returns:
countsdict

A dictionary containing the event types as keys with their counts as values.

Examples

>>> events = np.array([[0, 0, 1], [0, 0, 1], [0, 0, 5]])
>>> count_events(events)
{1: 2, 5: 1}
>>> count_events(events, ids=[1, 5])
{1: 2, 5: 1}
>>> count_events(events, ids=[1, 11])
{1: 2, 11: 0}