Skip to content
Closed
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/changes/latest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ Bugs

- Fix bug where setting of a montage with fNIRS data got set to "unknown" coordinate frame when it should have been in "head" (:gh:`9630` by `Alex Rockhill`_)

- Fix bug where "seeg", "ecog", "dbs" and "fnirs" data had coordinate frame unknown upon loading from a file when it should have been in "head" (:gh:`9636` by `Alex rockhill`_)

API changes
~~~~~~~~~~~
- In `mne.compute_source_morph`, the ``niter_affine`` and ``niter_sdr`` parameters have been replaced by ``niter`` and ``pipeline`` parameters for more consistent and finer-grained control of registration/warping steps and iteration (:gh:`9505` by `Alex Rockhill`_ and `Eric Larson`_)
Expand Down
4 changes: 1 addition & 3 deletions mne/channels/tests/test_montage.py
Original file line number Diff line number Diff line change
Expand Up @@ -1362,10 +1362,8 @@ def test_montage_head_frame(ch_type):
# gh-9446
data = np.random.randn(2, 100)
info = create_info(['a', 'b'], 512, ch_type)
coord_frame = getattr(
FIFF, f'FIFFV_COORD_{"HEAD" if ch_type == "eeg" else "UNKNOWN"}')
for ch in info['chs']:
assert ch['coord_frame'] == coord_frame
assert ch['coord_frame'] == FIFF.FIFFV_COORD_HEAD
raw = RawArray(data, info)
ch_pos = dict(a=[-0.00250136, 0.04913788, 0.05047056],
b=[-0.00528394, 0.05066484, 0.05061559])
Expand Down
4 changes: 4 additions & 0 deletions mne/io/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,10 @@ def _read_coord_trans_struct(fid, tag, shape, rlims):
FIFF.FIFFV_MEG_CH: FIFF.FIFFV_COORD_DEVICE,
FIFF.FIFFV_REF_MEG_CH: FIFF.FIFFV_COORD_DEVICE,
FIFF.FIFFV_EEG_CH: FIFF.FIFFV_COORD_HEAD,
FIFF.FIFFV_ECOG_CH: FIFF.FIFFV_COORD_HEAD,
FIFF.FIFFV_SEEG_CH: FIFF.FIFFV_COORD_HEAD,
FIFF.FIFFV_DBS_CH: FIFF.FIFFV_COORD_HEAD,
FIFF.FIFFV_FNIRS_CH: FIFF.FIFFV_COORD_HEAD,
}


Expand Down
12 changes: 12 additions & 0 deletions mne/io/tests/test_meas_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,18 @@ def test_io_dig_points(tmpdir):
read_polhemus_fastscan(dest, on_header_missing='warn')


def test_io_coord_frame(tmpdir):
"""Test round trip for coordinate frame."""
fname = tmpdir.join('test.fif')
for ch_type in ('eeg', 'seeg', 'ecog', 'dbs', 'hbo', 'hbr'):
info = create_info(
ch_names=['Test Ch'], sfreq=1000., ch_types=[ch_type])
info['chs'][0]['loc'][:3] = [0.05, 0.01, -0.03]
write_info(fname, info)
info2 = read_info(fname)
assert info2['chs'][0]['coord_frame'] == FIFF.FIFFV_COORD_HEAD


def test_make_dig_points():
"""Test application of Polhemus HSP to info."""
extra_points = read_polhemus_fastscan(
Expand Down