From 8fe49411d3bec287da827e8634cfba411970fd9a Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 3 Mar 2022 09:20:04 -0800 Subject: [PATCH 1/8] wip --- mne_bids/config.py | 7 +++++++ mne_bids/dig.py | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/mne_bids/config.py b/mne_bids/config.py index 499116a82..e5cb6c3d9 100644 --- a/mne_bids/config.py +++ b/mne_bids/config.py @@ -287,6 +287,13 @@ 'Commissure and the negative y-axis is passing through the ' 'Posterior Commissure. The positive z-axis is passing through ' 'a mid-hemispheric point in the superior direction.', + 'pixels': 'If electrodes are localized in 2D space (only x and y are ' + 'specified and z is n/a), then the positions in this file ' + 'must correspond to the locations expressed in pixels on ' + 'the photo/drawing/rendering of the electrodes on the brain. ' + 'In this case, coordinates must be (row,column) pairs, with ' + '(0,0) corresponding to the upper left pixel and (N,0) ' + 'corresponding to the lower left pixel.', 'ctf': 'ALS orientation and the origin between the ears', 'elektaneuromag': 'RAS orientation and the origin between the ears', '4dbti': 'ALS orientation and the origin between the ears', diff --git a/mne_bids/dig.py b/mne_bids/dig.py index c91bf7faa..69655e617 100644 --- a/mne_bids/dig.py +++ b/mne_bids/dig.py @@ -472,10 +472,10 @@ def _read_dig_bids(electrodes_fpath, coordsystem_fpath, # iEEG datatype for mne-python only supports # mni_tal == fsaverage == MNI305 if bids_coord_frame == 'Pixels': - warn("Coordinate frame of iEEG data in pixels does not " - "get read in by mne-python. Skipping reading of " - "electrodes.tsv ...") - coord_frame = None + warn("Coordinate frame of iEEG data in pixels is not " + "recognized mne-python, the coordinate frame " + "of the montage will be set to 'unknown'") + coord_frame = 'unknown' elif bids_coord_frame == 'ACPC': coord_frame = BIDS_TO_MNE_FRAMES.get(bids_coord_frame, None) elif bids_coord_frame == 'Other': From a6952720673939dcdc98ee9671f482a246dd784a Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 3 Mar 2022 10:43:21 -0800 Subject: [PATCH 2/8] fix montage going to head --- doc/whats_new.rst | 4 +++ mne_bids/dig.py | 56 ++++++++++++++++++++---------------- mne_bids/tests/test_write.py | 43 +++++++++++++++++++++++---- 3 files changed, 73 insertions(+), 30 deletions(-) diff --git a/doc/whats_new.rst b/doc/whats_new.rst index 7344e87da..05e9510ac 100644 --- a/doc/whats_new.rst +++ b/doc/whats_new.rst @@ -45,6 +45,8 @@ Enhancements - Similarly, :func:`mne_bids.get_head_mri_trans` and :func:`mne_bids.update_anat_landmarks` gained a new ``kind`` parameter to specify which of multiple landmark sets to operate on, by `Alexandre Gramfort`_ and `Richard Höchenberger`_ (:gh:`955`, :gh:`957`) +- Add support for ieeg data in the coordinate frame 'Pixels'; although MNE does not recognize this coordinate frame and so it will be set to "unknown" in the montage, MNE can still be used to analyze this kind of data, by `Alex Rockhill`_ (:gh:`976`) + API and behavior changes ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -74,6 +76,8 @@ Bug fixes - :func:`mne_bids.get_head_mri_trans` now respects ``datatype`` and ``suffix`` of the provided electrophysiological :class:`mne_bids.BIDSPath`, simplifying e.g. reading of derivaties, by `Richard Höchenberger`_ (:gh:`969`) +- Fix datasets with unknown coordinate frames being transformed to "head" with by assuming an identity transform, by `Alex Rockhill`_ (:gh:`976`) + :doc:`Find out what was new in previous releases ` .. include:: authors.rst diff --git a/mne_bids/dig.py b/mne_bids/dig.py index 69655e617..c8d98409b 100644 --- a/mne_bids/dig.py +++ b/mne_bids/dig.py @@ -10,6 +10,8 @@ import mne import numpy as np from mne.io.constants import FIFF +from mne.io._digitization import _get_fid_coords +from mne.transforms import _str_to_frame from mne.utils import logger, warn from mne_bids.config import (BIDS_IEEG_COORDINATE_FRAMES, @@ -36,11 +38,6 @@ def _handle_electrodes_reading(electrodes_fname, coord_frame, electrodes_dict = _from_tsv(electrodes_fname) ch_names_tsv = electrodes_dict['name'] - summary_str = [(ch, coord) for idx, (ch, coord) - in enumerate(electrodes_dict.items()) - if idx < 5] - logger.info("The read in electrodes file is: \n", summary_str) - def _float_or_nan(val): if val == "n/a": return np.nan @@ -300,6 +297,18 @@ def _write_coordsystem_json(*, raw, unit, hpi_coord_system, _write_json(fname, fid_json, overwrite=True) +def _set_montage_no_head_trans(raw, montage): + """Set a montage for raw without transforming to head.""" + pos = montage.get_positions() + ch_pos = pos['ch_pos'] + for ch in raw.info['chs']: # in BIDS channels in tsv will match with raw + if ch['ch_name'] in ch_pos: # skip MEG, non-digitized + ch['loc'][:3] = ch_pos[ch['ch_name']] + ch['coord_frame'] = _str_to_frame[pos['coord_frame']] + with raw.info._unlock(): + raw.info['dig'] = montage.dig + + def _write_dig_bids(bids_path, raw, montage=None, acpc_aligned=False, overwrite=False): """Write BIDS formatted DigMontage from Raw instance. @@ -334,9 +343,7 @@ def _write_dig_bids(bids_path, raw, montage=None, acpc_aligned=False, else: # prevent transformation back to "head", only should be used # in this specific circumstance - if bids_path.datatype == 'ieeg': - montage.remove_fiducials() - raw.set_montage(montage) + _set_montage_no_head_trans(raw, montage) # get coordinate frame from digMontage digpoint = montage.dig[0] @@ -352,15 +359,18 @@ def _write_dig_bids(bids_path, raw, montage=None, acpc_aligned=False, coord_frame = MNE_TO_BIDS_FRAMES.get(mne_coord_frame, None) if bids_path.datatype == 'ieeg' and mne_coord_frame == 'mri': - if acpc_aligned: - coord_frame = 'ACPC' - else: + if not acpc_aligned: raise RuntimeError( '`acpc_aligned` is False, if your T1 is not aligned ' 'to ACPC and the coordinates are in fact in ACPC ' 'space there will be no way to relate the coordinates ' 'to the T1. If the T1 is ACPC-aligned, use ' '`acpc_aligned=True`') + coord_frame = 'ACPC' + + if bids_path.datatype == 'ieeg' and bids_path.space is not None and \ + bids_path.space.lower() == 'pixels': + coord_frame = 'Pixels' # create electrodes/coordsystem files using a subset of entities # that are specified for these files in the specification @@ -378,9 +388,6 @@ def _write_dig_bids(bids_path, raw, montage=None, acpc_aligned=False, coordsystem_path = BIDSPath(**coord_file_entities, suffix='coordsystem', extension='.json') - logger.info(f'Writing electrodes file to... {electrodes_path}') - logger.info(f'Writing coordsytem file to... {coordsystem_path}') - if datatype == 'ieeg': if coord_frame is not None: # XXX: To improve when mne-python allows coord_frame='unknown' @@ -442,13 +449,8 @@ def _read_dig_bids(electrodes_fpath, coordsystem_fpath, Type of the data recording. Can be ``meg``, ``eeg``, or ``ieeg``. raw : mne.io.Raw - The raw data as MNE-Python ``Raw`` object. Will set montage - read in via ``raw.set_montage(montage)``. - - Returns - ------- - montage : mne.channels.DigMontage - The coordinate data as MNE-Python DigMontage object. + The raw data as MNE-Python ``Raw`` object. The montage + will be set in place. """ bids_coord_frame, bids_coord_unit = _handle_coordsystem_reading( coordsystem_fpath, datatype) @@ -473,7 +475,7 @@ def _read_dig_bids(electrodes_fpath, coordsystem_fpath, # mni_tal == fsaverage == MNI305 if bids_coord_frame == 'Pixels': warn("Coordinate frame of iEEG data in pixels is not " - "recognized mne-python, the coordinate frame " + "recognized by mne-python, the coordinate frame " "of the montage will be set to 'unknown'") coord_frame = 'unknown' elif bids_coord_frame == 'ACPC': @@ -535,6 +537,10 @@ def _read_dig_bids(electrodes_fpath, coordsystem_fpath, # XXX: Starting with mne 0.24, this will raise a RuntimeWarning # if channel types are included outside of # (EEG/sEEG/ECoG/DBS/fNIRS). Probably needs a fix in the future. - raw.set_montage(montage, on_missing='warn') - - return montage + fid_coords, _ = _get_fid_coords(montage.dig, raise_error=False) + has_fids = all([fid_coords[key] for key in ('nasion', 'lpa', 'rpa')]) + if has_fids: + raw.set_montage(montage, on_missing='warn') + else: + # leave in coordinate frame, don't assume identity unknown->head trans + _set_montage_no_head_trans(raw, montage) diff --git a/mne_bids/tests/test_write.py b/mne_bids/tests/test_write.py index 0e693373d..7f8a42a2d 100644 --- a/mne_bids/tests/test_write.py +++ b/mne_bids/tests/test_write.py @@ -41,6 +41,7 @@ write_meg_crosstalk, get_entities_from_fname, get_anat_landmarks, write, anonymize_dataset) from mne_bids.write import _get_fid_coords +from mne_bids.dig import _write_dig_bids, _read_dig_bids from mne_bids.utils import (_stamp_to_dt, _get_anonymization_daysback, get_anonymization_daysback, _write_json) from mne_bids.tsv_handler import _from_tsv, _to_tsv @@ -509,11 +510,7 @@ def test_fif(_bids_validate, tmp_path): assert op.isfile(op.join(bids_dir, sidecar_basename.basename)) bids_path.update(root=bids_root, datatype='eeg') - if check_version('mne', '0.24'): - with pytest.warns(RuntimeWarning, match='Not setting position'): - raw2 = read_raw_bids(bids_path=bids_path) - else: - raw2 = read_raw_bids(bids_path=bids_path) + raw2 = read_raw_bids(bids_path=bids_path) os.remove(op.join(bids_root, 'test-raw.fif')) events2, _ = mne.events_from_annotations(raw2, event_id) @@ -3556,3 +3553,39 @@ def test_anonymize_dataset_daysback(tmpdir): rng=np.random.default_rng(), show_progress_thresh=20 ) + + +def test_write_dig(tmpdir): + """Test whether the channel locations are written out properly.""" + # Check progress bar output + bids_root = tmpdir / 'bids' + data_path = Path(testing.data_path()) + raw_path = data_path / 'MEG' / 'sample' / 'sample_audvis_trunc_raw.fif' + + # test coordinates in pixels + bids_path = _bids_path.copy().update( + root=bids_root, datatype='ieeg', space='Pixels') + os.makedirs(op.join(bids_root, 'sub-01', 'ses-01', bids_path.datatype), + exist_ok=True) + raw = _read_raw_fif(raw_path, verbose=False) + raw.pick_types(eeg=True) + raw.del_proj() + raw.set_channel_types({ch: 'ecog' for ch in raw.ch_names}) + + montage = raw.get_montage() + # fake transform to pixel coordinates + montage.apply_trans(mne.transforms.Transform('head', 'unknown')) + _write_dig_bids(bids_path, raw, montage) + electrodes_path = bids_path.copy().update( + task=None, run=None, suffix='electrodes', extension='.tsv') + coordsystem_path = bids_path.copy().update( + task=None, run=None, suffix='coordsystem', extension='.json') + with pytest.warns(RuntimeWarning, + match='recognized by mne-python'): + _read_dig_bids(electrodes_path, coordsystem_path, + bids_path.datatype, raw) + montage2 = raw.get_montage() + assert montage2.get_positions()['coord_frame'] == 'unknown' + assert_array_almost_equal( + np.array(list(montage.get_positions()['ch_pos'].values())), + np.array(list(montage2.get_positions()['ch_pos'].values()))) From d8d831f39b8d649f069f0ebdc4bd421e7f698000 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 3 Mar 2022 11:09:46 -0800 Subject: [PATCH 3/8] allow fiducials in coordinate frame of data --- mne_bids/dig.py | 3 +++ mne_bids/utils.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mne_bids/dig.py b/mne_bids/dig.py index c8d98409b..60bceb50b 100644 --- a/mne_bids/dig.py +++ b/mne_bids/dig.py @@ -299,6 +299,9 @@ def _write_coordsystem_json(*, raw, unit, hpi_coord_system, def _set_montage_no_head_trans(raw, montage): """Set a montage for raw without transforming to head.""" + for d in raw.dig.copy(): # remove fiducials, not supported if not in head + if d['kind'] == FIFF.FIFFV_POINT_CARDINAL: + raw.dig.remove(d) pos = montage.get_positions() ch_pos = pos['ch_pos'] for ch in raw.info['chs']: # in BIDS channels in tsv will match with raw diff --git a/mne_bids/utils.py b/mne_bids/utils.py index 924f13fa9..0460e49da 100644 --- a/mne_bids/utils.py +++ b/mne_bids/utils.py @@ -291,9 +291,9 @@ def _extract_landmarks(dig): coords['RPA'] = landmarks[FIFF.FIFFV_POINT_RPA]['r'].tolist() coord_frame['RPA'] = landmarks[FIFF.FIFFV_POINT_RPA]['coord_frame'] - # for now, we only support "head" coordinates + # assert all in the same coordinate frame for frame in coord_frame.values(): - assert frame == FIFF.FIFFV_COORD_HEAD + assert frame == coord_frame['NAS'] return coords From 525c95a80981c9aa6006b18b490803b721dbbce0 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 3 Mar 2022 11:48:40 -0800 Subject: [PATCH 4/8] fix tests' --- mne_bids/dig.py | 34 +++++++++++----------------------- mne_bids/tests/test_read.py | 1 + mne_bids/tests/test_write.py | 10 ++++++++-- 3 files changed, 20 insertions(+), 25 deletions(-) diff --git a/mne_bids/dig.py b/mne_bids/dig.py index 60bceb50b..a0fc48615 100644 --- a/mne_bids/dig.py +++ b/mne_bids/dig.py @@ -297,21 +297,6 @@ def _write_coordsystem_json(*, raw, unit, hpi_coord_system, _write_json(fname, fid_json, overwrite=True) -def _set_montage_no_head_trans(raw, montage): - """Set a montage for raw without transforming to head.""" - for d in raw.dig.copy(): # remove fiducials, not supported if not in head - if d['kind'] == FIFF.FIFFV_POINT_CARDINAL: - raw.dig.remove(d) - pos = montage.get_positions() - ch_pos = pos['ch_pos'] - for ch in raw.info['chs']: # in BIDS channels in tsv will match with raw - if ch['ch_name'] in ch_pos: # skip MEG, non-digitized - ch['loc'][:3] = ch_pos[ch['ch_name']] - ch['coord_frame'] = _str_to_frame[pos['coord_frame']] - with raw.info._unlock(): - raw.info['dig'] = montage.dig - - def _write_dig_bids(bids_path, raw, montage=None, acpc_aligned=False, overwrite=False): """Write BIDS formatted DigMontage from Raw instance. @@ -346,7 +331,9 @@ def _write_dig_bids(bids_path, raw, montage=None, acpc_aligned=False, else: # prevent transformation back to "head", only should be used # in this specific circumstance - _set_montage_no_head_trans(raw, montage) + if bids_path.datatype == 'ieeg': + montage.remove_fiducials() + raw.set_montage(montage) # get coordinate frame from digMontage digpoint = montage.dig[0] @@ -540,10 +527,11 @@ def _read_dig_bids(electrodes_fpath, coordsystem_fpath, # XXX: Starting with mne 0.24, this will raise a RuntimeWarning # if channel types are included outside of # (EEG/sEEG/ECoG/DBS/fNIRS). Probably needs a fix in the future. - fid_coords, _ = _get_fid_coords(montage.dig, raise_error=False) - has_fids = all([fid_coords[key] for key in ('nasion', 'lpa', 'rpa')]) - if has_fids: - raw.set_montage(montage, on_missing='warn') - else: - # leave in coordinate frame, don't assume identity unknown->head trans - _set_montage_no_head_trans(raw, montage) + raw.set_montage(montage, on_missing='warn') + + # put back in unknown for unknown coordinate frame + if coord_frame == 'unknown': + for ch in raw.info['chs']: + ch['coord_frame'] = _str_to_frame['unknown'] + for d in raw.info['dig']: + d['coord_frame'] = _str_to_frame['unknown'] diff --git a/mne_bids/tests/test_read.py b/mne_bids/tests/test_read.py index aa0eeb7a5..033434f5c 100644 --- a/mne_bids/tests/test_read.py +++ b/mne_bids/tests/test_read.py @@ -787,6 +787,7 @@ def test_handle_ieeg_coords_reading(bids_path, tmp_path): orig_locs = raw.info['dig'][1] test_locs = raw_test.info['dig'][1] assert orig_locs == test_locs + print(object_diff(raw.info['chs'], raw_test.info['chs'])) assert not object_diff(raw.info['chs'], raw_test.info['chs']) # read in the data and assert montage is the same diff --git a/mne_bids/tests/test_write.py b/mne_bids/tests/test_write.py index 7f8a42a2d..6eebd143b 100644 --- a/mne_bids/tests/test_write.py +++ b/mne_bids/tests/test_write.py @@ -510,7 +510,11 @@ def test_fif(_bids_validate, tmp_path): assert op.isfile(op.join(bids_dir, sidecar_basename.basename)) bids_path.update(root=bids_root, datatype='eeg') - raw2 = read_raw_bids(bids_path=bids_path) + if check_version('mne', '0.24'): + with pytest.warns(RuntimeWarning, match='Not setting position'): + raw2 = read_raw_bids(bids_path=bids_path) + else: + raw2 = read_raw_bids(bids_path=bids_path) os.remove(op.join(bids_root, 'test-raw.fif')) events2, _ = mne.events_from_annotations(raw2, event_id) @@ -3575,7 +3579,9 @@ def test_write_dig(tmpdir): montage = raw.get_montage() # fake transform to pixel coordinates montage.apply_trans(mne.transforms.Transform('head', 'unknown')) - _write_dig_bids(bids_path, raw, montage) + with pytest.warns(RuntimeWarning, + match='assuming identity'): + _write_dig_bids(bids_path, raw, montage) electrodes_path = bids_path.copy().update( task=None, run=None, suffix='electrodes', extension='.tsv') coordsystem_path = bids_path.copy().update( From de6e4e79bb09b855e4d4e5b583b3bd1d15d8772c Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 3 Mar 2022 11:51:25 -0800 Subject: [PATCH 5/8] fix flake --- mne_bids/dig.py | 1 - 1 file changed, 1 deletion(-) diff --git a/mne_bids/dig.py b/mne_bids/dig.py index a0fc48615..82aad6da5 100644 --- a/mne_bids/dig.py +++ b/mne_bids/dig.py @@ -10,7 +10,6 @@ import mne import numpy as np from mne.io.constants import FIFF -from mne.io._digitization import _get_fid_coords from mne.transforms import _str_to_frame from mne.utils import logger, warn From 41c2df82a9e4ec075ec97bfc8211cf1c5e933920 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 3 Mar 2022 12:02:44 -0800 Subject: [PATCH 6/8] revert unneccesary changes --- mne_bids/tests/test_read.py | 1 - mne_bids/utils.py | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/mne_bids/tests/test_read.py b/mne_bids/tests/test_read.py index 033434f5c..aa0eeb7a5 100644 --- a/mne_bids/tests/test_read.py +++ b/mne_bids/tests/test_read.py @@ -787,7 +787,6 @@ def test_handle_ieeg_coords_reading(bids_path, tmp_path): orig_locs = raw.info['dig'][1] test_locs = raw_test.info['dig'][1] assert orig_locs == test_locs - print(object_diff(raw.info['chs'], raw_test.info['chs'])) assert not object_diff(raw.info['chs'], raw_test.info['chs']) # read in the data and assert montage is the same diff --git a/mne_bids/utils.py b/mne_bids/utils.py index 0460e49da..924f13fa9 100644 --- a/mne_bids/utils.py +++ b/mne_bids/utils.py @@ -291,9 +291,9 @@ def _extract_landmarks(dig): coords['RPA'] = landmarks[FIFF.FIFFV_POINT_RPA]['r'].tolist() coord_frame['RPA'] = landmarks[FIFF.FIFFV_POINT_RPA]['coord_frame'] - # assert all in the same coordinate frame + # for now, we only support "head" coordinates for frame in coord_frame.values(): - assert frame == coord_frame['NAS'] + assert frame == FIFF.FIFFV_COORD_HEAD return coords From 2bda182274126c9bdee41ac992becac1e3a046c5 Mon Sep 17 00:00:00 2001 From: Alex Rockhill Date: Fri, 4 Mar 2022 10:20:27 -0800 Subject: [PATCH 7/8] Update doc/whats_new.rst Co-authored-by: Alexandre Gramfort --- doc/whats_new.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/whats_new.rst b/doc/whats_new.rst index 05e9510ac..216632878 100644 --- a/doc/whats_new.rst +++ b/doc/whats_new.rst @@ -76,7 +76,7 @@ Bug fixes - :func:`mne_bids.get_head_mri_trans` now respects ``datatype`` and ``suffix`` of the provided electrophysiological :class:`mne_bids.BIDSPath`, simplifying e.g. reading of derivaties, by `Richard Höchenberger`_ (:gh:`969`) -- Fix datasets with unknown coordinate frames being transformed to "head" with by assuming an identity transform, by `Alex Rockhill`_ (:gh:`976`) +- Fix datasets with unknown coordinate frames being transformed to "head" by assuming an identity transform, by `Alex Rockhill`_ (:gh:`976`) :doc:`Find out what was new in previous releases ` From 6d42709dbc97ce60f0900c730d33acc01d91a963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20H=C3=B6chenberger?= Date: Fri, 4 Mar 2022 20:37:15 +0100 Subject: [PATCH 8/8] Apply suggestions from code review --- doc/whats_new.rst | 4 ++-- mne_bids/tests/test_write.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/whats_new.rst b/doc/whats_new.rst index 216632878..80b7bdd70 100644 --- a/doc/whats_new.rst +++ b/doc/whats_new.rst @@ -45,7 +45,7 @@ Enhancements - Similarly, :func:`mne_bids.get_head_mri_trans` and :func:`mne_bids.update_anat_landmarks` gained a new ``kind`` parameter to specify which of multiple landmark sets to operate on, by `Alexandre Gramfort`_ and `Richard Höchenberger`_ (:gh:`955`, :gh:`957`) -- Add support for ieeg data in the coordinate frame 'Pixels'; although MNE does not recognize this coordinate frame and so it will be set to "unknown" in the montage, MNE can still be used to analyze this kind of data, by `Alex Rockhill`_ (:gh:`976`) +- Add support for iEEG data in the coordinate frame ``Pixels``; although MNE-Python does not recognize this coordinate frame and so it will be set to ``unknown`` in the montage, MNE-Python can still be used to analyze this kind of data, by `Alex Rockhill`_ (:gh:`976`) API and behavior changes ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -76,7 +76,7 @@ Bug fixes - :func:`mne_bids.get_head_mri_trans` now respects ``datatype`` and ``suffix`` of the provided electrophysiological :class:`mne_bids.BIDSPath`, simplifying e.g. reading of derivaties, by `Richard Höchenberger`_ (:gh:`969`) -- Fix datasets with unknown coordinate frames being transformed to "head" by assuming an identity transform, by `Alex Rockhill`_ (:gh:`976`) +- Do not convert unknown coordinate frames to ``head``, by `Alex Rockhill`_ (:gh:`976`) :doc:`Find out what was new in previous releases ` diff --git a/mne_bids/tests/test_write.py b/mne_bids/tests/test_write.py index 6eebd143b..06f912109 100644 --- a/mne_bids/tests/test_write.py +++ b/mne_bids/tests/test_write.py @@ -3594,4 +3594,5 @@ def test_write_dig(tmpdir): assert montage2.get_positions()['coord_frame'] == 'unknown' assert_array_almost_equal( np.array(list(montage.get_positions()['ch_pos'].values())), - np.array(list(montage2.get_positions()['ch_pos'].values()))) + np.array(list(montage2.get_positions()['ch_pos'].values())) + )