Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add chpi to known channel list #1325

Merged
merged 7 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions doc/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`_

Expand Down Expand Up @@ -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`)
Expand Down
30 changes: 30 additions & 0 deletions mne_bids/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,36 @@ 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.
mne_valid_types = [
"bio",
"chpi",
"dbs",
# "dipole", # currently not converted
"ecg",
"ecog",
"eeg",
"emg",
"eog",
"exci",
# "eyetrack", # currently not converted
# "fnirs", # currently not converted
# "gof", # currently not converted
"gsr",
"ias",
"misc",
# "meg", # inferred in more detail
"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."""
Expand Down
1 change: 1 addition & 0 deletions mne_bids/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def _get_ch_type_mapping(fro="mne", to="bids"):
megrefgradaxial="MEGREFGRADAXIAL",
meggradplanar="MEGGRADPLANAR",
megrefmag="MEGREFMAG",
chpi="HLU",
ias="MEGOTHER",
syst="MEGOTHER",
exci="MEGOTHER",
Expand Down