Skip to content
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion doc/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ Detailed list of changes
🧐 API and behavior changes
^^^^^^^^^^^^^^^^^^^^^^^^^^^

- `tracksys` accepted as argument in :class:`mne_bids.BIDSPath()` by `Julius Welzel`_ (:gh:`1430`)
- ``tracksys`` accepted as argument in :class:`mne_bids.BIDSPath()` by `Julius Welzel`_ (:gh:`1430`)
- :func:`mne_bids.read_raw_bids()` has a new parameter ``on_ch_mismatch`` that controls behaviour when there is a mismatch between channel names in ``channels.tsv`` and the raw data; accepted values are ``'raise'`` (default), ``'reorder'``, and ``'rename'``, by `Kalle Mäkelä`_.
- Column names read from ``.tsv`` are now converted from `numpy.str_` class to built-in `str` class, by `Daniel McCloy`_ (:gh:`1478`).

🛠 Requirements
^^^^^^^^^^^^^^^
Expand Down
3 changes: 2 additions & 1 deletion mne_bids/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -1766,7 +1766,8 @@ def get_entities_from_fname(fname, on_error="raise", verbose=None):
'space': None, \
'recording': None, \
'split': None, \
'description': None}
'description': None, \
'tracking_system': None}
"""
if on_error not in ("warn", "raise", "ignore"):
raise ValueError(
Expand Down
5 changes: 3 additions & 2 deletions mne_bids/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,8 +592,8 @@ def events_file_to_annotation_kwargs(events_fname: str | Path) -> dict:
... 'duration': [0.1, 0.1, 0.1],
... 'trial_type': ['event1', 'event2', 'event1'],
... 'value': [1, 2, 1],
... 'sample': [10, 20, 30]
'foo': ['a', 'b', 'c'],
... 'sample': [10, 20, 30],
... 'foo': ['a', 'b', 'c'],
... }
>>> df = pd.DataFrame(data)
>>>
Expand All @@ -604,6 +604,7 @@ def events_file_to_annotation_kwargs(events_fname: str | Path) -> dict:
>>>
>>> # Read the events file using the function
>>> events_dict = events_file_to_annotation_kwargs(events_file)
Reading events from /tmp/events.tsv.
>>> events_dict
{'onset': array([0.1, 0.2, 0.3]),
'duration': array([0.1, 0.1, 0.1]),
Expand Down
2 changes: 1 addition & 1 deletion mne_bids/tests/test_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ def test_handle_events_reading(tmp_path, with_extras):
match=re.escape(
"The version of MNE-Python you are using (<1.10) "
"does not support the extras argument in mne.Annotations. "
"The extra column(s) [np.str_('foo')] will be ignored."
"The extra column(s) ['foo'] will be ignored."
),
)
if with_extras and not check_version("mne", "1.10")
Expand Down
2 changes: 1 addition & 1 deletion mne_bids/tsv_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def _from_tsv(fname, dtypes=None):
# If data is 1-dimensional (only header), make it 2D
data = np.atleast_2d(data)

column_names = data[0, :]
column_names = data[0, :].tolist() # cast to list to avoid `np.str_()` keys in dict
info = data[1:, :]
data_dict = OrderedDict()
if dtypes is None:
Expand Down
Loading