Repository navigation
Deprecation hygiene for 2.0: no drop_last_window warning from create_from_X_y/create_from_mne_raw; examples use on_last_window; fix tutorial_create_fixed_window_length - #1530
Merged
bruAristimunha merged 1 commit intoNov 2, 2026
Conversation
bruAristimunha
added a commit
to bruAristimunha/braindecode
that referenced
this pull request
Nov 2, 2026
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the deprecation cleanup and example updates.
No open issues 🎉
What changed in this PR
Prepares Braindecode for 2.0 by removing unavoidable deprecation warnings, updating examples to the replacement windowing API, and correcting tutorial errors while preserving windowing behavior.
Changes:
- Map required
drop_last_windowarguments internally toon_last_window, with regression tests for warnings and window counts. - Migrate examples to
on_last_windowand repair the fixed-length-window tutorial; its lazy-metadata printing fix remains covered by #1529. - Correct EEGNet’s deprecation guidance and document the fixes.
| File | Description |
|---|---|
test/unit_tests/datasets/test_xy.py |
Test warning suppression and window counts for both boolean values. |
test/unit_tests/datasets/test_mne.py |
Test warning suppression and equivalent event-window counts. |
examples/model_building/plot_regression.py |
Use explicit overlap behavior. |
examples/model_building/plot_heterogeneous_montage_training.py |
Use explicit drop behavior. |
examples/model_building/plot_bcic_iv_2a_moabb_cropped.py |
Use explicit overlap behavior. |
examples/datasets_io/plot_tuh_discrete_multitarget.py |
Use explicit overlap behavior. |
examples/datasets_io/plot_benchmark_preprocessing.py |
Replace the positional deprecated argument with explicit drop behavior. |
examples/datasets_io/benchmark_lazy_eager_loading.py |
Use explicit drop behavior. |
examples/applied_examples/tutorial_create_fixed_window_length.py |
Update windowing guidance and fix channel selection, thresholds, targets, unpacking, and metadata access. |
examples/applied_examples/plot_tuh_eeg_corpus.py |
Use explicit overlap behavior. |
examples/applied_examples/plot_dance_event_detection.py |
Use explicit drop behavior. |
examples/advanced_training/plot_transfer_learning.py |
Use explicit drop behavior. |
examples/advanced_training/bcic_iv_4_ecog_cropped.py |
Use overlap behavior for all three dataset splits. |
docs/whats_new.rst |
Document deprecation cleanup and example fixes. |
braindecode/models/eegnet.py |
Point the deprecation warning to an existing parameter. |
braindecode/datasets/xy.py |
Translate the legacy boolean before fixed-length windowing. |
braindecode/datasets/mne.py |
Translate the legacy boolean before event windowing. |
Review effort: Balanced
bruAristimunha
force-pushed
the
bd2deep/examples-2.0
branch
from
November 2, 2026 17:18
ab30780 to
97626b7
Compare
…from_X_y/create_from_mne_raw; examples use on_last_window - create_from_X_y and create_from_mne_raw take drop_last_window as a required argument and passed it on to the windowers, so every call emitted the drop_last_window DeprecationWarning; they now pass the equivalent on_last_window. Windows are unchanged. - The examples pass on_last_window instead of the deprecated drop_last_window. - tutorial_create_fixed_window_length (not run by the gallery, whose pattern only runs plot_*) failed: Pick(eeg=True, ...) is not a pick() argument; it uses Pick(picks='eeg'). - EEGNet's final_layer_with_constraint=False deprecation pointed to a final_layer_linear parameter that does not exist. * tutorial_create_fixed_window_length: reject threshold in the units of the scaled data * tutorial_create_fixed_window_length: float reject thresholds (mypy) and unpack the window indices too * tutorial_create_fixed_window_length: take the session as target before mapping it * tutorial_create_fixed_window_length: read the targets with get_metadata() on the windows dataset
bruAristimunha
force-pushed
the
bd2deep/examples-2.0
branch
from
November 2, 2026 17:22
97626b7 to
75c559b
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1530 +/- ##
=======================================
Coverage 91.34% 91.34%
=======================================
Files 170 170
Lines 22105 22113 +8
=======================================
+ Hits 20192 20200 +8
Misses 1913 1913 🚀 New features to boost your workflow:
|
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.
Deprecation hygiene for 2.0, from executing all 42 examples with a warning hook in the release audit (
bd2-deep).Library (no change to windows or outputs)
create_from_X_yandcreate_from_mne_rawtakedrop_last_windowas a required argument and passed it on to the windowers. Every call therefore emitted thedrop_last_window ... will be removed in version 2.1DeprecationWarning, telling the user to passon_last_window, which these functions do not accept. They now map the bool to the equivalenton_last_windowthemselves. New tests check that no such warning is emitted and that the window counts are unchanged.on_last_windowand deprecation path before the 2.1 removal.final_layer_with_constraint=Falsedeprecation told users to usefinal_layer_linear=True, a parameter that does not exist. It now says to passfinal_layer_with_constraint=True. The existing test matches the unchanged first sentence.Examples
on_last_windowinstead of the deprecateddrop_last_window(True→"drop",False→"overlap", as the deprecation says).tutorial_create_fixed_window_length.pyhas never run in docs CI, because the gallery only executesplot_*. It crashed at several points:Pick(eeg=True, meg=False, stim=False)(notpick()arguments) is nowPick(picks="eeg");150e-6on data already scaled to µV rejected every window; it is now150.0;X, y = windows_dataset[0]on 3-tuples;mappingon sessions without selecting the session as target; it now callsset_target("session");.windows.get_metadata()on anEEGWindowsDataset.print()of alazy_metadata=Truedataset needs FIX repr of windows datasets built with lazy_metadata=True (NotImplementedError / KeyError) #1529.Verified in Voyager Jobs:
pre-commit run --fileson the changed files exits 0;test_xy.py,test_mne.py,test_windowers.pyand the EEGNet tests: 185 passed;drop_last_windowwarnings, apart from the tutorial;