diff --git a/doc/changes/devel/13112.bugfix.rst b/doc/changes/devel/13112.bugfix.rst new file mode 100644 index 00000000000..1bffca6cdef --- /dev/null +++ b/doc/changes/devel/13112.bugfix.rst @@ -0,0 +1 @@ +Fix bug with :func:`mne.io.read_raw_egi` where ``info["dev_head_t"]`` was an identity matrix instead of ``None``, by `Eric Larson`_. diff --git a/mne/_fiff/meas_info.py b/mne/_fiff/meas_info.py index 28f0629c323..8eac4b2bf1e 100644 --- a/mne/_fiff/meas_info.py +++ b/mne/_fiff/meas_info.py @@ -3315,7 +3315,7 @@ def create_info(ch_names, sfreq, ch_types="misc", verbose=None): ) -def _empty_info(sfreq): +def _empty_info(sfreq, *, dev_head_t=True): """Create an empty info dictionary.""" from ..transforms import Transform @@ -3364,7 +3364,11 @@ def _empty_info(sfreq): info["highpass"] = 0.0 info["sfreq"] = float(sfreq) info["lowpass"] = info["sfreq"] / 2.0 - info["dev_head_t"] = Transform("meg", "head") + if dev_head_t is True: + dev_head_t = Transform("meg", "head") + elif dev_head_t is False: + dev_head_t = None + info["dev_head_t"] = dev_head_t info._update_redundant() info._check_consistency() return info diff --git a/mne/io/egi/egimff.py b/mne/io/egi/egimff.py index c3a10fb72cd..c68723c23d5 100644 --- a/mne/io/egi/egimff.py +++ b/mne/io/egi/egimff.py @@ -440,7 +440,7 @@ def __init__( assert egi_events.shape[1] == egi_info["last_samps"][-1] meas_dt_utc = egi_info["meas_dt_local"].astimezone(datetime.timezone.utc) - info = _empty_info(egi_info["sfreq"]) + info = _empty_info(egi_info["sfreq"], dev_head_t=False) info["meas_date"] = _ensure_meas_date_none_or_dt(meas_dt_utc) info["utc_offset"] = egi_info["utc_offset"] info["device_info"] = dict(type=egi_info["device"]) diff --git a/mne/io/egi/tests/test_egi.py b/mne/io/egi/tests/test_egi.py index 584714d9c8a..08995fba6a0 100644 --- a/mne/io/egi/tests/test_egi.py +++ b/mne/io/egi/tests/test_egi.py @@ -83,6 +83,7 @@ def test_egi_mff_pause(fname, skip_times, event_times): events_as_annotations=False, ) assert raw.info["sfreq"] == 250.0 # true for all of these files + assert raw.info["dev_head_t"] is None # no MEG data assert len(raw.annotations) == len(skip_times) # assert event onsets match expected times