, merge=None, proj=False, name=None, bads=None, stim_channel=None, events=None, annotations=None, feature='onset', **kwargs)

Load events from a raw fiff file.

  • raw (Path | str | BaseRaw) – The raw fiff file from which to extract events (if raw and events are both None, a file dialog will be displayed to select a raw file).

  • merge (int) – Merge stimulus channel steps occurring in neighboring samples. The integer value indicates across how many samples events should be merged, and the sign indicates in which direction they should be merged (negative means towards the earlier event, positive towards the later event). By default, this parameter is based on the data: -1 for KIT data, 0 otherwise. The main reason for merging events is an artifact from analog event recording systems. If events are recorded in an analog channel, event onsets can be blurred (what should be 0, 0, 0, 1, 1, 1, ..., can look like 0, 0, 0, 0.5, 1, 1, ...; merge=-1 would turn the latter into the former).

  • proj (bool | str) – Path to the projections file that will be loaded with the raw file. '{raw}' will be expanded to the raw file’s path minus extension. With proj=True, '{raw}_*proj.fif' will be used, looking for any projection file starting with the raw file’s name. If multiple files match the pattern, a ValueError will be raised.

  • name (str) – A name for the Dataset. If None, the raw filename will be used.

  • bads (List) – Specify additional bad channels in the raw data file (these are added to the ones that are already defined in the raw file).

  • stim_channel (str | Sequence[str]) – Name of the stim channel or all the stim channels affected by the trigger. If None, the config variables ‘MNE_STIM_CHANNEL’, ‘MNE_STIM_CHANNEL_1’, ‘MNE_STIM_CHANNEL_2’, etc. are read. If these are not found, it will default to ‘STI 014’.

  • events (str) – If events are stored in a fiff file separate from the Raw object, the path to the events file can be supplied here. The events in the Dataset will reflect the event sin the events file rather than the raw file.

  • annotations (bool) – Generate events from annotations instead of the stim channel (by default, annotations are used when present).

  • ** – Keyword arguments for loading the raw file (see or

  • feature (Literal['onset', 'offset', 'step'])


A Dataset with the following variables:
  • i_start: the index of the event in the raw file.

  • trigger: the event value/id.

  • event: the event label (only for events from annotations).

The Dataset’s info dictionary contains the following values:
  • raw: the mne Raw object.

Return type: