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
BUG: CTF and proj (re)application #5342
Comments
What do you think of breaking this up into multiple PRs?
and convert this RuntimeError to a RuntimeWarning Lines 403 to 408 in 4f7f515
This would revert us to pre #5133 status, and you/we would have slightly more time to properly triage this? |
Seems reasonable as an intermediate step to me |
We should do this intermediate step for 0.17 and the full fix for 0.18. @bloyl do you have time in the next two weeks to do the |
... and just a note that whatever fix we have should incorporate the gist that will eventually show up in #5384 :) |
similar to #5610 if possible we should check that covariance objects match the compensation grade of data they are being applied to. |
Unfortunately for |
so are we screwed? what are your thoughts?
|
I'll have to look deeper at the code and the output. For example if we always store the uncompensated one, then it can be compensated then picked on the fly. It's possible this already happens, I haven't checked |
@agramfort @larsoner greets from Lyon. People run into this issue and it blocks their progress in adopting MNE :) essentially what we see is that you have to drop the ref channels in order to apply refs. We see that excluding the reference channels is hard-coded that https://github.com/mne-tools/mne-python/blob/master/mne/proj.py#L74. I'm wondering what is the right thing to do here ... |
can you be more specific? do you have a script that crashes where it should
not?
|
We can see if we can repeat it on CTF sample data. What we see is that computing projs and applying them is broken if ref channels are present because the proj by default excludes them. |
In principle we should be able to:
So we need to:
info['comps']
.info['projs']
complete with the set of channels that were used when they were applied, i.e., do not subselect channels ifproj['active']
.epochs(..., picks=[1], proj=True)
, raise an error telling people to useproj=False
because they should not reapply?comps
andproj
and data channels in the forward object during inverse application.This non-reduction of the
projs
, however, would create some things to think about:master
, if you apply projs, then subselect channels, then compute the inverse, the projection operator is reapplied (I think?). This is a bit weird because it means that there were actually two spatial operators that got applied, but only the last (with fewer channels) gets applied to the lead fields.n_proj
-- we would just underestimate the rank, which is at least safer than overestimating it (and blowing up near-zero singular values).This would probably take a lot of careful coding and testing to get right, but it should be doable. It seems like the cleanest option. @agramfort do you see any problems with this approach?
The text was updated successfully, but these errors were encountered: