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 support for writing neuromag122 data to BIDS #1110

Merged
merged 3 commits into from
Dec 10, 2022
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: 1 addition & 1 deletion .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ jobs:
uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: test-0-${{ env.pythonLocation }}-${{ env.os }}-${{ hashFiles('setup.cfg') }}-${{ hashFiles('test_requirements.txt') }}
key: test-1-${{ env.pythonLocation }}-${{ env.os }}-${{ hashFiles('setup.cfg') }}-${{ hashFiles('test_requirements.txt') }}

- name: Install Python dependencies using pip
run: |
Expand Down
1 change: 1 addition & 0 deletions doc/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ Detailed list of changes
- When writing data containing :class:`mne.Annotations` **and** passing events to :func:`~mne_bids.write_raw_bids`, previously, annotations whose description did not appear in ``event_id`` were silently dropped. We now raise an exception and request users to specify mappings between descriptions and event codes in this case. It is still possible to omit ``event_id`` if no ``events`` are passed, by `Richard Höchenberger`_ (:gh:`1084`)
- When working with NIRS data, raise the correct error message when a faulty ``format`` argument is passed to :func:`~mne_bids.write_raw_bids`, by `Stefan Appelhoff`_ (:gh:`1092`)
- Fixed writing data preloaded from a format that's not supported by BIDS, by `Richard Höchenberger`_ (:gh:`1101`)
- Fixed writing data from neuromag system having 122 sensors, by `Alexandre Gramfort`_ (:gh:`1109`)

:doc:`Find out what was new in previous releases <whats_new_previous_releases>`

Expand Down
1 change: 1 addition & 0 deletions mne_bids/pick.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def get_coil_types():
FIFF.FIFFV_COIL_VV_MAG_T1,
FIFF.FIFFV_COIL_VV_MAG_T2,
FIFF.FIFFV_COIL_VV_MAG_T3,
FIFF.FIFFV_COIL_NM_122,
FIFF.FIFFV_COIL_MAGNES_MAG,
FIFF.FIFFV_COIL_BABY_MAG),
megrefmag=(FIFF.FIFFV_COIL_KIT_REF_MAG,
Expand Down
19 changes: 19 additions & 0 deletions mne_bids/tests/test_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -3897,3 +3897,22 @@ def test_unknown_extension(_bids_validate, tmp_path):

write_raw_bids(raw, bids_path, allow_preload=True, format='FIF')
_bids_validate(bids_root)


@testing.requires_testing_data
def test_write_neuromag122(_bids_validate, tmp_path):
"""Test writing Neuromag122 data to BIDS."""
bids_root = tmp_path / 'bids'
raw_fname = data_path / 'MEG' / 'sample' / 'sample_audvis_trunc_raw.fif'
raw = mne.io.read_raw_fif(raw_fname, allow_maxshield=True)
raw.info["line_freq"] = 50 # power line frequency as required by BIDS
raw.pick('mag')
for c in raw.info['chs']:
c['coil_type'] = FIFF.FIFFV_COIL_NM_122

bids_path = BIDSPath(subject="01", task="wordreport", run="01",
root=bids_root,
extension=".fif", datatype="meg")
write_raw_bids(raw, bids_path, overwrite=True, allow_preload=True,
format="FIF")
_bids_validate(bids_root)