Skip to content

Commit 0598c07

Browse files
committed
FIX: Progress
1 parent 3052ff2 commit 0598c07

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

mne_bids/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# SPDX-License-Identifier: BSD-3-Clause
55

66
import mne
7+
import mne.datasets.utils
78
import pytest
89

910

mne_bids/read.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)