diff --git a/CITATION.cff b/CITATION.cff index 98bec4910..4d81d73c1 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -189,8 +189,11 @@ authors: orcid: 'https://orcid.org/0000-0001-6364-7272' - given-names: Thomas family-names: Hartmann - affiliation: 'Paris-Lodron-University Salzburg, Centre for Cogntitive Neuroscience, Department of Psychology, Salzburg, Austria' + affiliation: 'Paris-Lodron-University Salzburg, Centre for Cognitive Neuroscience, Department of Psychology, Salzburg, Austria' orcid: 'https://orcid.org/0000-0002-8298-8125' + - given-names: Aaron + family-names: Earle-Richardson + affiliation: 'Duke University School of Medicine, Department of Neurology' - given-names: Alexandre family-names: Gramfort affiliation: 'Université Paris-Saclay, Inria, CEA, Palaiseau, France' diff --git a/doc/authors.rst b/doc/authors.rst index 1d0cb016e..552b8d4b0 100644 --- a/doc/authors.rst +++ b/doc/authors.rst @@ -1,3 +1,4 @@ +.. _Aaron Earle-Richardson: https://github.com/Aaronearlerichardson .. _Mainak Jas: https://jasmainak.github.io/ .. _Teon Brooks: https://teonbrooks.com .. _Chris Holdgraf: https://bids.berkeley.edu/people/chris-holdgraf diff --git a/doc/whats_new.rst b/doc/whats_new.rst index 492feddd0..34e451527 100644 --- a/doc/whats_new.rst +++ b/doc/whats_new.rst @@ -17,8 +17,9 @@ Version 0.16 (unreleased) The following authors contributed for the first time. Thank you so much! 🤩 -* `Kaare Mikkelsen`_ +* `Aaron Earle-Richardson`_ * `Amaia Benitez`_ +* `Kaare Mikkelsen`_ * `Thomas Hartmann`_ The following authors had contributed before. Thank you for sticking around! 🤘 @@ -53,6 +54,7 @@ Detailed list of changes ^^^^^^^^^^^^ - When anonymizing the date of a recording, MNE-BIDS will no longer error during `~mne_bids.write_raw_bids` if passing a `~mne.io.Raw` instance to ``empty_room``, by `Daniel McCloy`_ (:gh:`1270`) +- Dealing with alphanumeric ``sub`` entity labels is now fixed for :func:`~mne_bids.write_raw_bids`, by `Aaron Earle-Richardson`_ (:gh:`1291`) ⚕️ Code health ^^^^^^^^^^^^^^ diff --git a/mne_bids/tests/test_write.py b/mne_bids/tests/test_write.py index 629c7c422..7f50037ff 100644 --- a/mne_bids/tests/test_write.py +++ b/mne_bids/tests/test_write.py @@ -254,15 +254,16 @@ def test_write_participants(_bids_validate, tmp_path): _to_tsv(data, participants_tsv) # write in now another subject - bids_path.update(subject="03") + # (use alphanumeric label to test for GH-1291) + bids_path.update(subject="D03") write_raw_bids(raw, bids_path, verbose=False) data = _from_tsv(participants_tsv) # hand should have been written properly with now 'n/a' for sub-01 and - # sub-03, but 'L' for sub-03 + # sub-02, but 'L' for sub-D03 assert data["hand"][data["participant_id"].index("sub-01")] == "n/a" assert data["hand"][data["participant_id"].index("sub-02")] == "n/a" - assert data["hand"][data["participant_id"].index("sub-03")] == "L" + assert data["hand"][data["participant_id"].index("sub-D03")] == "L" # check to make sure participant data is overwritten, but keeps the fields # if there are extra fields that were user defined diff --git a/mne_bids/tsv_handler.py b/mne_bids/tsv_handler.py index 532caa370..7e986d5f7 100644 --- a/mne_bids/tsv_handler.py +++ b/mne_bids/tsv_handler.py @@ -82,8 +82,8 @@ def _contains_row(data, row_data): # Cast row_value to the same dtype as data_value to avoid a NumPy # FutureWarning, see # https://github.com/mne-tools/mne-bids/pull/372 - row_value = np.array(row_value, dtype=data_value.dtype) - + if data_value.size > 0: + row_value = np.array(row_value, dtype=data_value.dtype) column_mask = np.isin(data_value, row_value) mask = column_mask if mask is None else (mask & column_mask) return np.any(mask)