Skip to content

Commit

Permalink
add support for writting neuromag122 data to bids (#1110)
Browse files Browse the repository at this point in the history
* add support for writting neuromag122 data to bids

* update what's new

* Nuke cache

Co-authored-by: Richard Höchenberger <richard.hoechenberger@gmail.com>
  • Loading branch information
agramfort and hoechenberger authored Dec 10, 2022
1 parent ae79d0c commit 79439c8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
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)

0 comments on commit 79439c8

Please sign in to comment.