Skip to content

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 into
braindecode:masterfrom
bruAristimunha:bd2deep/examples-2.0
Nov 2, 2026

Conversation

@bruAristimunha

Copy link
Copy Markdown
Collaborator

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_y and create_from_mne_raw take drop_last_window as a required argument and passed it on to the windowers. Every call therefore emitted the drop_last_window ... will be removed in version 2.1 DeprecationWarning, telling the user to pass on_last_window, which these functions do not accept. They now map the bool to the equivalent on_last_window themselves. New tests check that no such warning is emitted and that the window counts are unchanged.
    • Bruno: these two functions still need their own on_last_window and deprecation path before the 2.1 removal.
  • EEGNet's final_layer_with_constraint=False deprecation told users to use final_layer_linear=True, a parameter that does not exist. It now says to pass final_layer_with_constraint=True. The existing test matches the unchanged first sentence.

Examples

  • The 12 call sites in 9 examples pass on_last_window instead of the deprecated drop_last_window (True → "drop", False → "overlap", as the deprecation says).
  • tutorial_create_fixed_window_length.py has never run in docs CI, because the gallery only executes plot_*. It crashed at several points:
    • Pick(eeg=True, meg=False, stim=False) (not pick() arguments) is now Pick(picks="eeg");
    • a reject threshold of 150e-6 on data already scaled to µV rejected every window; it is now 150.0;
    • X, y = windows_dataset[0] on 3-tuples;
    • mapping on sessions without selecting the session as target; it now calls set_target("session");
    • .windows.get_metadata() on an EEGWindowsDataset.
    • print() of a lazy_metadata=True dataset needs FIX repr of windows datasets built with lazy_metadata=True (NotImplementedError / KeyError) #1529.

Verified in Voyager Jobs:

Copilot AI balanced review requested due to automatic review settings November 2, 2026 17:15
bruAristimunha added a commit to bruAristimunha/braindecode that referenced this pull request Nov 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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_window arguments internally to on_last_window, with regression tests for warnings and window counts.
  • Migrate examples to on_last_window and 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

…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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the deprecation cleanup and tutorial updates.

No open issues 🎉

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 2, 2026 17:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block the deprecation-warning cleanup, API migration, and tutorial fixes.

No open issues 🎉

Review effort: Balanced

@codecov

codecov Bot commented Nov 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.34%. Comparing base (535e058) to head (75c559b).
⚠️ Report is 7 commits behind head on master.

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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bruAristimunha
bruAristimunha merged commit a9af010 into braindecode:master Nov 2, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants