Read :term:`events` from fif or text file. See :ref:`tut-events-vs-annotations` and :ref:`tut-event-arrays` for more information about events. Parameters ---------- filename : path-like Name of the input file. If the extension is ``.fif``, events are read assumi
(
filename,
include=None,
exclude=None,
mask=None,
mask_type="and",
return_event_id=False,
verbose=None,
)
| 204 | |
| 205 | @verbose |
| 206 | def read_events( |
| 207 | filename, |
| 208 | include=None, |
| 209 | exclude=None, |
| 210 | mask=None, |
| 211 | mask_type="and", |
| 212 | return_event_id=False, |
| 213 | verbose=None, |
| 214 | ): |
| 215 | """Read :term:`events` from fif or text file. |
| 216 | |
| 217 | See :ref:`tut-events-vs-annotations` and :ref:`tut-event-arrays` |
| 218 | for more information about events. |
| 219 | |
| 220 | Parameters |
| 221 | ---------- |
| 222 | filename : path-like |
| 223 | Name of the input file. |
| 224 | If the extension is ``.fif``, events are read assuming |
| 225 | the file is in FIF format, otherwise (e.g., ``.eve``, |
| 226 | ``.lst``, ``.txt``) events are read as coming from text. |
| 227 | Note that new format event files do not contain |
| 228 | the ``"time"`` column (used to be the second column). |
| 229 | include : int | list | None |
| 230 | A event id to include or a list of them. |
| 231 | If None all events are included. |
| 232 | exclude : int | list | None |
| 233 | A event id to exclude or a list of them. |
| 234 | If None no event is excluded. If include is not None |
| 235 | the exclude parameter is ignored. |
| 236 | mask : int | None |
| 237 | The value of the digital mask to apply to the stim channel values. |
| 238 | If None (default), no masking is performed. |
| 239 | mask_type : ``'and'`` | ``'not_and'`` |
| 240 | The type of operation between the mask and the trigger. |
| 241 | Choose 'and' (default) for MNE-C masking behavior. |
| 242 | |
| 243 | .. versionadded:: 0.13 |
| 244 | return_event_id : bool |
| 245 | If True, ``event_id`` will be returned. This is only possible for |
| 246 | ``-annot.fif`` files produced with MNE-C ``mne_browse_raw``. |
| 247 | |
| 248 | .. versionadded:: 0.20 |
| 249 | %(verbose)s |
| 250 | |
| 251 | Returns |
| 252 | ------- |
| 253 | %(events)s |
| 254 | event_id : dict |
| 255 | Dictionary of ``{str: int}`` mappings of event IDs. |
| 256 | |
| 257 | See Also |
| 258 | -------- |
| 259 | find_events, write_events |
| 260 | |
| 261 | Notes |
| 262 | ----- |
| 263 | This function will discard the offset line (i.e., first line with zero |