Repository navigation
Fix FilterBankSSVEP reusing the first dataset's filter bands - #1368
Open
Srizdebnath wants to merge 2 commits into
Open
Srizdebnath wants to merge 2 commits into
Srizdebnath wants to merge 2 commits into
Conversation
With filters=None, BaseSSVEP.prepare_process builds the bands around the event frequencies of the dataset, but it stored them in self.filters and only did so while self.filters was None. Every later dataset processed by the same paradigm instance was filtered with the first dataset's bands.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
FilterBankSSVEP()(andBaseSSVEP(filters=None)) builds its filter bank from the event frequencies of the dataset, one[f - 0.5, f + 0.5]band per frequency.BaseSSVEP.prepare_processdid this only whileself.filters is None, and wrote the result intoself.filters. So the first dataset a paradigm instance processed fixed the bands for good: every later dataset passed through the same instance (an evaluation over several datasets, ormoabb.benchmark) was filtered at the first dataset's frequencies, with the first dataset's number of bands.Reproduction with two fake datasets shaped like Kalunga2016 (13, 17, 21 Hz + rest) and Nakanishi2015 (12 frequencies, 9.25 to 14.75 Hz):
On
develop:With this branch:
The second dataset is what a fresh
FilterBankSSVEP()gives on it alone, so results depended on the order of the datasets in the run (this is the symptom reported in #659, alongside the first-band issue fixed in #1291).The fix
BaseSSVEP.__init__records whether the bands are to be derived from the events (filters is None), andprepare_processderives them again for every dataset in that case. ExplicitfiltersandSSVEP(fmin, fmax)are unchanged.Tests
test_FilterBankSSVEP_filters_follow_each_datasetruns oneFilterBankSSVEP()on a 2-frequency and then a 3-frequency fake dataset and checks the bands and the last dimension ofXfor both. It fails ondevelop(the second dataset gets 2 bands at 13 and 15 Hz) and passes here.pytest moabb/tests/test_paradigms.pypasses;ruff check/ruff format --checkare clean on the touched files.