Skip to content

Commit

Permalink
Add chpi to known channel list (#1325)
Browse files Browse the repository at this point in the history
* add chpi to known channel list

* removed some ch types from testing

* change chpi to BIDS type HLU

* adapt changelog

* remove myself from authors again?
  • Loading branch information
skjerns authored Oct 22, 2024
1 parent a0ff786 commit c1d59ec
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
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

0 comments on commit c1d59ec

Please sign in to comment.