Skip to content
Open
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
1 change: 1 addition & 0 deletions doc/changes/dev/13520.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Preserve ``kit_system_id`` in forward-solution ``Info``, by :newcontrib: 'Melih Yayli'
1 change: 1 addition & 0 deletions doc/changes/names.inc
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@
.. _Matti Hämäläinen: https://research.aalto.fi/en/persons/matti-h%C3%A4m%C3%A4l%C3%A4inen/
.. _Matti Toivonen: https://github.com/mattitoi
.. _Mauricio Cespedes Tenorio: https://github.com/mcespedes99
.. _Melih Yayli: https://github.com/yaylim
.. _Michael Straube: https://github.com/mistraube
.. _Michal Žák: https://github.com/michalrzak
.. _Michiru Kaneda: https://github.com/rcmdnk
Expand Down
7 changes: 6 additions & 1 deletion mne/forward/_make_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ def _prepare_for_forward(
mri_id = dict(machid=np.zeros(2, np.int32), version=0, secs=0, usecs=0)

info_trans = str(trans) if isinstance(trans, Path) else trans
info = Info(
kwargs_fwd_info = dict(
chs=info["chs"],
comps=info["comps"],
# The forward-writing code always wants a dev_head_t, so give an identity one
Expand All @@ -510,6 +510,11 @@ def _prepare_for_forward(
bads=info["bads"],
mri_head_t=mri_head_t,
)

if "kit_system_id" in info:
kwargs_fwd_info["kit_system_id"] = info["kit_system_id"]

info = Info(**kwargs_fwd_info)
info._update_redundant()
info._check_consistency()
logger.info("")
Expand Down
3 changes: 3 additions & 0 deletions mne/forward/tests/test_make_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@ def test_make_forward_solution_kit(tmp_path, fname_src_small):
)
_compare_forwards(fwd, fwd_py, 157, n_src_small, meg_rtol=1e-3, meg_atol=1e-7)

# NEW TEST: ensure kit_system_id survives the forward-info rewrite
assert "kit_system_id" in fwd_py["info"]


@requires_mne
def test_make_forward_solution_bti(fname_src_small):
Expand Down