-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Raising meaningful warnings/errors for interpolate_bads, when supplie… #13518
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
…d loc field with missing or invalid data
for more information, see https://pre-commit.ci
|
Should we update the user about what's going on, on a deeper level or is it going to be too verbose. Because if we look, that why the bug exists, its primarily because of how create_info creates the info dict structure - its all NaN for the loc field. Of course we're not expecting the user to provide the exact positions of the sensor but we should also give the user a heads up about this. Also in the add_channels, something like: And something similar for the interpolate_bads. If that's the case then we should create a separate utility method for this, something like: def _is_invalid_loc(loc):
return np.allclose(loc, 0.0, atol=1e-16) or np.isnan(loc).any()And use that, wherever its required to warn the user about this. |
|
@1himan I haven't followed this ticket super closely but if I understand correctly it seems like you are talking about 2 or 3 different ideas here: 1: "Should we update the user about what's going on on a deeper level [during the
|
for more information, see https://pre-commit.ci
…, Parameters {on_no_position} not found - fix
…ne-python into interpolate_bads_bugfix
|
Ready to run rest of the tests? |
drammock
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.
Thanks for the contribution!
there should be a test (or modification of an existing test) to ensure that this works as intended. For example, a pytest.raises() context around a call when the value is "raise", a pytest.warns() context around a call when the value is "warn", and no context (or a null context) when called with the value "ignore". Should also assert that the invalid chs end up as all NaN (though since that's current behavior I'm guessing that's already tested, but please confirm)
|
I've made the suggested changes @drammock. and yes, the assertion for bad channel interpolated to all nan values is already implemented. |
Raising meaningful warnings/errors for interpolate_bads, when supplied loc field with missing or invalid data.
What does this implement/fix?
Fix - raise error in interpolate_bads if no sensor positions are provided
Additional information
TODO:
Add checks in add_channels() as well.
Refactor code according to mne's philosophy.