-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
FIX: adding kit_system_id info to forward solution #13520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
When raw.info contains a kit_system_id, the function make_forward_solution expects this value to be present during forward computation and raises an error if it is missing. Previously, the kit_system_id field was unintentionally dropped when constructing the Info object used for the forward solution, leading to this failure. This PR resolves the issue by preserving the kit_system_id field during Info creation. An explicit if check ensures that the field is added only when it is present in raw.info; if it is not present, no kit_system_id is included. This maintains consistency with the original metadata while avoiding unnecessary or incorrect fields.
|
Hello! 👋 Thanks for opening your first pull request here! ❤️ We will try to get back to you soon. 🚴 |
larsoner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable to me!
Can you add a doc/changes/dev/13520.bugfix.rst using :newcontrib:? And also add some test that fails on main but passes on this PR? I'd expect something like
assert "kit_system_id" in fwd["info"]
would do it.
| info = Info( | ||
| chs=info["chs"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To minimize diff and preserve blame how about
kwargs_fwd_info = dict(
...
)
then only a few lines change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for your comments, can you tell me where I should add the test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe in this test somewhere?
| def test_make_forward_solution_kit(tmp_path, fname_src_small): |
- Created .rst file - Added test in test_make_forward.py - Updated the changes made in _make_forward.py
for more information, see https://pre-commit.ci
When working with KIT MEG systems, the
kit_system_idfield is an important piece of metadata associated with the recording setup. Previously, this field was lost during construction of theInfoobject used in the forward-solution pipeline, which made it unavailable in downstream contexts where it may be needed (e.g., during data conversion or when accessing KIT-specific metadata). This PR ensures thatkit_system_idis preserved whenever it is present inraw.info. An explicit if check adds the field only when it exists, so the behavior remains consistent for non-KIT datasets while maintaining important metadata for KIT recordings.