-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
FIX: check weight_norm parameter #5946
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
Conversation
ebfffcc to
779b212
Compare
Codecov Report
@@ Coverage Diff @@
## master #5946 +/- ##
==========================================
- Coverage 88.91% 87.09% -1.82%
==========================================
Files 401 401
Lines 72825 72825
Branches 12109 12109
==========================================
- Hits 64750 63426 -1324
- Misses 5189 6561 +1372
+ Partials 2886 2838 -48 |
|
good to go or not? |
wmvanvliet
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.
I agree with adding the check, but this implementation is too verbose for my taste. Why not add at the appropriate place in _compute_beamformer the following, once:
if weight_norm not in ['nai', 'unit-noise-gain', None]:
raise ValueError('Unrecognized weight normalization option, '
'available choices are "nai", "unit-noise-gain" and None; '
'got "%s".' % weight_norm)|
My apologies, I hadn't read the PR carefully.
This is a good idea. This situation comes up frequently and may indeed warrant a convenience function. However, this is probably best left to a separate PR. In this PR, let's implement the check with as little code as necessary. |
|
@massich can you rebase this one and let's merge. thanks a lot |
779b212 to
6ca3164
Compare
|
@wmvanvliet merge if happy. Then you would have to remove these lines in #5958. But I guess that what I was asking at the beginning still holds: do both methods support the |
mne/beamformer/_lcmv.py
Outdated
| raise ValueError('Unrecognized weight normalization option in ' | ||
| 'weight_norm, available choices are None and ' | ||
| '"unit-noise-gain", got "%s".' % weight_norm) | ||
| _check_weight_norm(weight_norm) |
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.
No! _lcmv_source_power does not support weight norms other than 'unit-noise-gain'!
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.
This is one for the beamformer agenda :)
|
@wmvanvliet you can push directly to the PR as core dev of MNE-Python. I think it's the fastest way to move on. If you know what needs to be done it's faster to push the 2 lines fixes that going over 3 rounds of comments. my 2c |
This comment has been minimized.
This comment has been minimized.
7f2c063 to
5f45039
Compare
|
Thanks, @massich! |
Reference issue
Example: Fixes #5945
What does this implement/fix?
checks that
weight_norm : 'unit-noise-gain' | 'nai' | NoneAdditional information
@jaaval now this snipped errors with a meaningful error
This is the result of runing the MWE
--
@wmvanvliet can you make sure that this is ok? The
'nai'option was added in#5447. I've seen that
tf_lcmwthe'nai'option is not there. And this PR nowmakes
'nai'valid for_lcmv_source_power.Maybe we can also use this PR to update the doc and make use of the doccer that
@larsoner put in place.
I also see this kind of checkings in many places, maybe we should factor it out and
have a prameter checker or something, that unifies the errors etc.