-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
MRG, BUG: Make sure resample return at least one sample #9897
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
|
not sure to get it. You expose a bug by adding a new test but the CIs pass. What do I miss? |
|
@agramfort I skipped the CI for now, wanted to push a fix first, probably this afternoon. |
|
I gave it some thought, and IMO, it just doesn't make sense to allow resampling to yield 0 data points and to return an empty instance. I chose to raise an error when it happens. If you disagree and prefer to have resample always return at least one datapoint, then I can change it to return e.g. the first datapoint when I don't see a use case for resampling to a frequency yielding only 1 point, and 0 makes even less sense to me. Please let me know if you can think of a use case! Previously, |
…ft:94: in _get_backward_norm
|
I'm guessing <compat / old / py3.7> runs with CUDA, and that in this case, numpy had this issue covered with a ValueError raised. I matched the error type/msg with numpy. |
|
@mscheltienne I pushed a commit to add one more |
|
Added changelog entry under your name for this one, as I didn't do much except create the PR 😄 |
And find the problem, and think about a solution, and work through it, and add a test... I think your name should be there, too :) |
|
Thanks @mscheltienne ! |
Issue spotted in xdawn decoding example, when replacing
tmp_info['sfreq'] = 1.withepochs.copy().resample(1).https://github.com/mne-tools/mne-python/blob/main/examples/decoding/decoding_xdawn_eeg.py#L105-L106
Original post: