-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Introduce lower bounds for ExG peak detection thresholds #9311
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
Introduce lower bounds for ExG peak detection thresholds #9311
Conversation
This comment has been minimized.
This comment has been minimized.
|
Looks like a deprecation warning from jinja, which will need to be fixed upstream in Sphinx.
…-------- Original Message --------
On Apr 18, 2021, 07:36, Richard Höchenberger wrote:
***@***.***(https://github.com/drammock) ***@***.***(https://github.com/larsoner) It seems there's a problem with Circle that's unrelated to my PR, could you please have a look?
—
You are receiving this because you were mentioned.
Reply to this email directly, [view it on GitHub](#9311 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AAN2AU3ZKFL22NCOU5ZXGNDTJLG5NANCNFSM43EAKTGQ).
|
|
So should I pin our jinja to an older version perhaps? |
we don't directly depend on jinja; it's a sphinx dependency. I think the right thing to do is to open an issue upstream in the sphinx repo, and add this particular deprecation warning to the |
|
That's correct! |
mne/preprocessing/_peak_finder.py
Outdated
| try: | ||
| eps = 1e2 * np.finfo(x0.dtype).eps | ||
| except ValueError: # int dtypes are exact | ||
| eps = 0. |
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 don't like try except blocks. They are too implicit. Here i would say that either we support integer inputs and you should check that dtype is int-like or if not you should cast to a float with the same nbytes. See
https://github.com/scikit-learn/scikit-learn/blob/main/sklearn/utils/validation.py#L173
how it's done in sklearn.
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'm now simply casting unless it's already a float, see 20361b4
You okay with that?
doc/conf.py
Outdated
| 'ignore', message="can't resolve package from", category=ImportWarning) | ||
| warnings.filterwarnings( | ||
| 'ignore', message='.*mne-realtime.*', category=DeprecationWarning) | ||
| warnings.filterwarnings( |
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 was errantly duplicated
Also perhaps you don't need these changes anymore? The latest CircleCI PR doc builds have been green at least
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 reverted the changes and now we get the deprecation warnings again and an exception :(
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.
looks like you reverted too much! the jinja glue line was supposed to stay... it's just the accidentally dupllicated mne-realtime line that needed reverting
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 thought even the jinja-glue wouldn't be needed since builds are passing on other PRs. But maybe this PR changes something that makes it necessary? Or the caching is making different builds use different versions of Sphinx or something?
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.
version of sphinx is the same between this failed circleCI build and the successful one on #9316 (both use 4.0.0b1). Jinja is different (3.0.0rc1 here versus 3.0.0a1 there)
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.
the jinja error is happening on #9292 now also.
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.
Feel free to port the fix over. Personally I would do it just by adding another line to the DeprecationWarnings list a few lines above
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.
(around line 770 of conf.py)
This reverts commit 640df64.
| raise ValueError( | ||
| f'The selected threshold value is too small for peak detection ' | ||
| f'due to inevitable floating-point imprecisions.\nPlease pick a ' | ||
| f'value >= {eps:g} (You passed thresh={thresh})') |
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 am not convinced this is right. We have to keep in mind eps is relative to 1., it's not an absolute minimum delta between floats (that would be finfo(x0.dtype).tiny, and even that's before going denormalized). For example consider this on main, which seems correct:
>>> import mne
>>> import numpy as np
>>> x = np.full(1000, 1e-20)
>>> x[500] = 2e-20
>>> mne.preprocessing.peak_finder(x)
(array([500]), array([2.e-20]))
But we have
>>> (np.max(x) - np.min(x)) / 4
2.5e-21
>>> 1e2 * np.finfo(x.dtype).eps
2.220446049250313e-14
So this PR will find nothing significant.
For EEG/EOG data in V, this might be okay. For data in T or T/M, these hang out around 1e-12 so this can become problematic.
|
Moving to 0.24 so that whatever solution we come up with we have time to test properly before release |
|
Bumping milestone again |
|
Let's keep track of this in #9273. Closing. |
Fixes #9273
We set
100 * epsas the lower bound.