Skip to content

Commit 2eefeb9

Browse files
yaylimpre-commit-ci[bot]larsoner
authored
FIX: adding kit_system_id info to forward solution (#13520)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Eric Larson <[email protected]>
1 parent 98afbb2 commit 2eefeb9

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

doc/changes/dev/13520.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Preserve ``kit_system_id`` in forward-solution ``Info``, by :newcontrib: 'Melih Yayli'

doc/changes/names.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@
210210
.. _Matti Hämäläinen: https://research.aalto.fi/en/persons/matti-h%C3%A4m%C3%A4l%C3%A4inen/
211211
.. _Matti Toivonen: https://github.com/mattitoi
212212
.. _Mauricio Cespedes Tenorio: https://github.com/mcespedes99
213+
.. _Melih Yayli: https://github.com/yaylim
213214
.. _Michael Straube: https://github.com/mistraube
214215
.. _Michal Žák: https://github.com/michalrzak
215216
.. _Michiru Kaneda: https://github.com/rcmdnk

mne/forward/_make_forward.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ def _prepare_for_forward(
496496
mri_id = dict(machid=np.zeros(2, np.int32), version=0, secs=0, usecs=0)
497497

498498
info_trans = str(trans) if isinstance(trans, Path) else trans
499-
info = Info(
499+
kwargs_fwd_info = dict(
500500
chs=info["chs"],
501501
comps=info["comps"],
502502
# The forward-writing code always wants a dev_head_t, so give an identity one
@@ -510,6 +510,11 @@ def _prepare_for_forward(
510510
bads=info["bads"],
511511
mri_head_t=mri_head_t,
512512
)
513+
514+
if "kit_system_id" in info:
515+
kwargs_fwd_info["kit_system_id"] = info["kit_system_id"]
516+
517+
info = Info(**kwargs_fwd_info)
513518
info._update_redundant()
514519
info._check_consistency()
515520
logger.info("")

mne/forward/tests/test_make_forward.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,9 @@ def test_make_forward_solution_kit(tmp_path, fname_src_small):
270270
)
271271
_compare_forwards(fwd, fwd_py, 157, n_src_small, meg_rtol=1e-3, meg_atol=1e-7)
272272

273+
# NEW TEST: ensure kit_system_id survives the forward-info rewrite
274+
assert "kit_system_id" in fwd_py["info"]
275+
273276

274277
@requires_mne
275278
def test_make_forward_solution_bti(fname_src_small):

0 commit comments

Comments
 (0)