-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
ENH: Add function to determine time-resolved chpi status #11122
Conversation
For now I would make it just work for Neuromag systems and raise an error for others
The logic in |
Both suggestions sound good. I meant to add a test for inactive hpis in neuromag systems, too, but I can't find files in mne_data that I can use for that. The ones I tried miss the Line 1410 in 01cad56
In my own test file, those fields are present though, such that the method works. Any ideas? |
Did you check test_move_anon_raw.fif ? It should have it
for tests that already use it, see https://github.com/mne-tools/mne-python/blob/main/mne/tests/test_chpi.py#L41 |
Yeah, I use it to test whether the method works for when the cHPIs were active. But I though I would also test a file where cHPI were inactive. And a file for that I can't find. Or is that overkill? |
Ideally we would have such a test file but we don't. I would just fake it in the test with something like:
Then also verify it works properly on some of your actual files, and I think we can trust that the hack of setting the |
yeah, sounds reasonable. As far as I am concerned, the PR is ready for review. |
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.
LGTM other than a couple of minor things! Can you also please
- update
latest.inc
as well - add it to tutorials/preprocessing/60_maxwell_filtering_sss.py or examples/preprocessing/movement_compensation.py in some suitable place
I think this is ready for merging @larsoner |
Thanks @eort ! |
References issue #940 in the mne-bids repository that is about mne-bids incorrectly setting the cHPI field in the meg recording sidecar.
Based on that discussion, we (i.e. @larsoner) thought that it might be useful to have a function in mne that returns the time-resolved number of active HPI coils. With that information it should be possible to infer whether continous HPI was active or not.
This PR is work in progress. I mostly wanted to shift the discussion over here. What still misses:
implementation for CTF filesimplementation for KIT files(?)I don't know anything about CTF files nor any files available (other than those in mne-data), but if I understand the test below correctly, for CTF files it holds that if there are any HPI coils in the data file, they are automatically on. If there are not present, they are obviously off. Can someone who has experience with such files (dis)confirm that?
mne-python/mne/tests/test_chpi.py
Line 664 in 9634536
Same holds for KIT files. If it is not clear, we could also implement only for neuromag systems and return some defaults for other systems, together with a info/warning or something like that.
Furthermore, I am not sure whether inference by suffix is robust enough to determine the manufacturer (neuromag, ctf, kit, etc). Is there a better way?