@@ -541,7 +541,8 @@ def _handle_info_reading(sidecar_fname, raw):
541541 return raw
542542
543543
544- def events_file_to_annotation_kwargs (events_fname : str | Path ) -> dict :
544+ @verbose
545+ def events_file_to_annotation_kwargs (events_fname : str | Path , * , verbose = None ) -> dict :
545546 r"""
546547 Read the ``events.tsv`` file and extract onset, duration, and description.
547548
@@ -569,6 +570,7 @@ def events_file_to_annotation_kwargs(events_fname: str | Path) -> dict:
569570 ``events.tsv`` file. Each dictionary corresponds to a row.
570571 This corresponds to the ``extras`` argument of class
571572 :class:`mne.Annotations`.
573+ %(verbose)s
572574
573575 Notes
574576 -----
@@ -603,16 +605,16 @@ def events_file_to_annotation_kwargs(events_fname: str | Path) -> dict:
603605 >>> df.to_csv(events_file, sep='\t', index=False)
604606 >>>
605607 >>> # Read the events file using the function
606- >>> events_dict = events_file_to_annotation_kwargs(events_file)
607- Reading events from /tmp /events.tsv.
608+ >>> events_dict = events_file_to_annotation_kwargs(events_file, verbose=True) # doctest:+ELLIPSIS
609+ Reading events from ... /events.tsv.
608610 >>> events_dict
609611 {'onset': array([0.1, 0.2, 0.3]),
610612 'duration': array([0.1, 0.1, 0.1]),
611613 'description': array(['event1', 'event2', 'event1'], dtype='<U6'),
612614 'event_id': {'event1': 1, 'event2': 2},
613615 'extras': [{'foo': 'a'}, {'foo': 'b'}, {'foo': 'c'}]}
614616
615- """
617+ """ # noqa: E501
616618 logger .info (f"Reading events from { events_fname } ." )
617619 events_dict = _from_tsv (events_fname )
618620
@@ -680,7 +682,7 @@ def events_file_to_annotation_kwargs(events_fname: str | Path) -> dict:
680682 pass
681683 event_id = dict (zip (culled [trial_type_col_name ], culled_vals ))
682684 else :
683- event_id = dict (zip (trial_types , np . arange ( len (trial_types ))))
685+ event_id = dict (zip (trial_types , list ( range ( len (trial_types ) ))))
684686 descrs = np .asarray (trial_types , dtype = str )
685687
686688 # convert onsets & durations to floats ("n/a" onsets were already dropped)
0 commit comments