From 6d7eca70c6740204fa03df5ed162b0fd124bd2bc Mon Sep 17 00:00:00 2001 From: skjerns <14980558+skjerns@users.noreply.github.com> Date: Mon, 21 Oct 2024 17:23:59 +0200 Subject: [PATCH 1/5] add chpi to known channel list --- mne_bids/tests/test_utils.py | 29 +++++++++++++++++++++++++++++ mne_bids/utils.py | 1 + 2 files changed, 30 insertions(+) diff --git a/mne_bids/tests/test_utils.py b/mne_bids/tests/test_utils.py index 0f08454c4..bcf79caa9 100644 --- a/mne_bids/tests/test_utils.py +++ b/mne_bids/tests/test_utils.py @@ -39,6 +39,35 @@ def test_get_ch_type_mapping(): with pytest.raises(ValueError, match='specified from "bogus" to "mne"'): _get_ch_type_mapping(fro="bogus", to="mne") + # check that all mne types have a corresponding BIDS translation + # last update from mne 0.19.0. The following have been removed: + # dipole, fnirs, gof, we could add them to BIDS conversion though + mne_valid_types = [ + "bio", + "chpi", + "dbs", + "dipole", + "ecg", + "ecog", + "eeg", + "emg", + "eog", + "exci", + "eyetrack", + "gsr", + "ias", + "misc", + "meg", + "resp", + "seeg", + "stim", + "syst", + "temperature", + ] + map_mne_to_bids = _get_ch_type_mapping(fro="mne", to="bids") + for ch_type in mne_valid_types: + assert ch_type in map_mne_to_bids + def test_handle_datatype(): """Test the automatic extraction of datatype from the data.""" diff --git a/mne_bids/utils.py b/mne_bids/utils.py index fe3ad5738..ae22f665f 100644 --- a/mne_bids/utils.py +++ b/mne_bids/utils.py @@ -82,6 +82,7 @@ def _get_ch_type_mapping(fro="mne", to="bids"): megrefgradaxial="MEGREFGRADAXIAL", meggradplanar="MEGGRADPLANAR", megrefmag="MEGREFMAG", + chpi="MEGOTHER", ias="MEGOTHER", syst="MEGOTHER", exci="MEGOTHER", From c23f0bb7a88251343f762304d5ae977bdb6b83ed Mon Sep 17 00:00:00 2001 From: skjerns <14980558+skjerns@users.noreply.github.com> Date: Tue, 22 Oct 2024 09:56:18 +0200 Subject: [PATCH 2/5] removed some ch types from testing --- mne_bids/tests/test_utils.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mne_bids/tests/test_utils.py b/mne_bids/tests/test_utils.py index bcf79caa9..d23b53684 100644 --- a/mne_bids/tests/test_utils.py +++ b/mne_bids/tests/test_utils.py @@ -40,24 +40,25 @@ def test_get_ch_type_mapping(): _get_ch_type_mapping(fro="bogus", to="mne") # check that all mne types have a corresponding BIDS translation - # last update from mne 0.19.0. The following have been removed: - # dipole, fnirs, gof, we could add them to BIDS conversion though + # last update from mne 0.19.0. mne_valid_types = [ "bio", "chpi", "dbs", - "dipole", + # "dipole", # currently not converted "ecg", "ecog", "eeg", "emg", "eog", "exci", - "eyetrack", + # "eyetrack", # currently not converted + # "fnirs", # currently not converted + # "gof", # currently not converted "gsr", "ias", "misc", - "meg", + # "meg", # inferred in more detail "resp", "seeg", "stim", From 7335e267edc6b2d90d16bd6d2ba44a549ff7d71a Mon Sep 17 00:00:00 2001 From: Simon Kern <14980558+skjerns@users.noreply.github.com> Date: Tue, 22 Oct 2024 11:02:33 +0200 Subject: [PATCH 3/5] change chpi to BIDS type HLU --- mne_bids/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mne_bids/utils.py b/mne_bids/utils.py index ae22f665f..05aac7523 100644 --- a/mne_bids/utils.py +++ b/mne_bids/utils.py @@ -82,7 +82,7 @@ def _get_ch_type_mapping(fro="mne", to="bids"): megrefgradaxial="MEGREFGRADAXIAL", meggradplanar="MEGGRADPLANAR", megrefmag="MEGREFMAG", - chpi="MEGOTHER", + chpi="HLU", ias="MEGOTHER", syst="MEGOTHER", exci="MEGOTHER", From ca0ac168c3c6a6e1495a5f00f2fa999d666ef018 Mon Sep 17 00:00:00 2001 From: skjerns <14980558+skjerns@users.noreply.github.com> Date: Tue, 22 Oct 2024 14:07:29 +0200 Subject: [PATCH 4/5] adapt changelog --- CITATION.cff | 4 ++++ doc/whats_new.rst | 2 ++ 2 files changed, 6 insertions(+) diff --git a/CITATION.cff b/CITATION.cff index 0d585b07e..85e1f74fc 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -206,6 +206,10 @@ authors: family-names: Jas affiliation: 'Athinoula A. Martinos Center for Biomedical Imaging, Massachusetts General Hospital, Charlestown, MA, USA' orcid: 'https://orcid.org/0000-0002-3199-9027' + - given-names: Simon + family-names: Kern + affiliation: 'Central Institute of Mental Health, Mannheim, Germany' + orcid: 'https://orcid.org/0000-0002-9050-9040' type: software repository-code: 'https://github.com/mne-tools/mne-bids' license: BSD-3-Clause diff --git a/doc/whats_new.rst b/doc/whats_new.rst index 0bc77bb7a..cb0048152 100644 --- a/doc/whats_new.rst +++ b/doc/whats_new.rst @@ -20,6 +20,7 @@ The following authors contributed for the first time. Thank you so much! 🤩 * `Aaron Earle-Richardson`_ * `Amaia Benitez`_ * `Kaare Mikkelsen`_ +* `Simon Kern`_ * `Thomas Hartmann`_ * `William Turner`_ @@ -55,6 +56,7 @@ Detailed list of changes 🪲 Bug fixes ^^^^^^^^^^^^ +- Writing MEGIN data with MNE channel types `chpi` will now map to BIDS type HLU by `Simon Kern`_ (:gh:`1325`) - 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`) - When processing subject_info data that MNE Python imports as numpy arrays with only one item, MNE-BIDS now unpacks these, resulting in a correct participants.tsv, by `Thomas Hartmann`_ (:gh:`1310`) From b332bfc1dd4bdd06d6bca171680af9679ca488e2 Mon Sep 17 00:00:00 2001 From: skjerns <14980558+skjerns@users.noreply.github.com> Date: Tue, 22 Oct 2024 14:11:54 +0200 Subject: [PATCH 5/5] remove myself from authors again? --- CITATION.cff | 4 ---- 1 file changed, 4 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index 85e1f74fc..0d585b07e 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -206,10 +206,6 @@ authors: family-names: Jas affiliation: 'Athinoula A. Martinos Center for Biomedical Imaging, Massachusetts General Hospital, Charlestown, MA, USA' orcid: 'https://orcid.org/0000-0002-3199-9027' - - given-names: Simon - family-names: Kern - affiliation: 'Central Institute of Mental Health, Mannheim, Germany' - orcid: 'https://orcid.org/0000-0002-9050-9040' type: software repository-code: 'https://github.com/mne-tools/mne-bids' license: BSD-3-Clause