Repository navigation
FIX repr of windows datasets built with lazy_metadata=True (NotImplementedError / KeyError) - #1529
Merged
bruAristimunha merged 1 commit intoNov 2, 2026
Conversation
bruAristimunha
added a commit
to bruAristimunha/braindecode
that referenced
this pull request
Nov 2, 2026
BaseConcatDataset.__repr__/_repr_html_ summarize the windows' metadata with column indexing, which _LazyDataFrame does not support, so printing create_fixed_length_windows(..., lazy_metadata=True) raised NotImplementedError (found by running tutorial_create_fixed_window_length). The per-dataset summary already skipped lazy metadata; the concat summary now does the same.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Mixed eager and lazy window datasets produce misleading aggregate summaries because lazy metadata is skipped without suppressing or labeling the resulting partial statistics.
1 open issue
What changed in this PR
This PR fixes text and HTML representations of window datasets created with lazy_metadata=True, addressing failures in the dataset summaries introduced by #934.
Changes:
- Skip unsupported column access when summarizing lazy metadata.
- Convert the first crop row to an array for positional access.
- Add a regression test and a bug-fix changelog entry.
| File | Description |
|---|---|
test/unit_tests/datasets/test_dataset.py |
Tests concat text/HTML and child text representations with lazy metadata. |
docs/whats_new.rst |
Documents the representation fixes. |
braindecode/datasets/base.py |
Handles lazy metadata in concat summaries and crop-row access. |
Review effort: Balanced
Comment on lines
+153
to
+156
| if not isinstance(md, pd.DataFrame): | ||
| # lazy metadata (lazy_metadata=True) only supports row access, as | ||
| # in _metadata_summary: no window sizes or target counts from it | ||
| continue |
bruAristimunha
force-pushed
the
bd2deep/lazy-metadata-repr
branch
from
November 2, 2026 17:18
cd08202 to
daab46a
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1529 +/- ##
==========================================
+ Coverage 91.34% 91.36% +0.02%
==========================================
Files 170 170
Lines 22105 22107 +2
==========================================
+ Hits 20192 20199 +7
+ Misses 1913 1908 -5 🚀 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.

Printing a windows dataset built with
lazy_metadata=Trueraises:BaseConcatDataset.__repr__and_repr_html_(#934) summarize the windows' metadata with column indexing (md["i_stop_in_trial"]), which_LazyDataFramedoes not support. The concat summary (_concat_metadata_summary) now skips lazy metadata, as the per-dataset_metadata_summaryalready did. The per-dataset repr also failed:_window_inforead the first crop row withfirst[2], but a lazy row is apd.Serieslabelled by column, so it raisedKeyError. It now reads the row by position. For such datasets the repr shows no window sizes or target counts. This affects 1.8.x too. It was found by runningexamples/applied_examples/tutorial_create_fixed_window_length.py, which prints such a dataset; the gallery does not execute that file.test_repr_of_windows_with_lazy_metadata.Verified in a Voyager Job:
pre-commit run --filesexits 0, andpytest test_dataset.py test_windowers.py -k "repr or lazy"passes (33 passed).