Skip to content

Commit

Permalink
BUG: Fix dev_head_t for EEG data
Browse files Browse the repository at this point in the history
  • Loading branch information
larsoner committed Feb 11, 2025
1 parent cf5ef5f commit 4a88d1b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions mne/_fiff/meas_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion mne/io/egi/egimff.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down
1 change: 1 addition & 0 deletions mne/io/egi/tests/test_egi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4a88d1b

Please sign in to comment.