You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
34 of 147 datasets have self-contradictory channel metadata, and the validator that would catch it is never called #1163
AcquisitionMetadata carries three descriptions of the same fact — n_channels, channel_types and sensors — and nothing checks they agree. Measured across the catalogue:
34 of 147 datasets have n_channels != sum(channel_types.values())
34 of 147 have n_channels != len(sensors)
Examples:
dataset
n_channels
sum(channel_types)
len(sensors)
BNCI2014_004
3
6
6
BNCI2016_002
59
69
69
BNCI2019_001
61
64
64
BNCI2020_001
58
64
64
BNCI2015_009
60
62
—
Why it matters
This is the metadata that hid the BNCI2025_001 label leak fixed in #1161: it declared n_channels=67 with channel_types={"eeg": 67, "eog": 4} — internally contradictory, and contradicted again by its own 60-electrode montage. The 7 extra channels were hand kinematics and the reaching target, typed eeg and picked as features.
A one-line invariant would have surfaced it offline, with no data download.
There is already a validator, and nothing calls it
moabb/datasets/metadata/schema.py:725 defines validate_metadata_against_dataset(dataset, metadata). It is exported from moabb/datasets/metadata/__init__.py and listed in __all__ — and grep -rn validate_metadata_against_dataset moabb/ finds only its own definition, the re-exports, and its docstring example. It has no callers and no test.
Suggested fix
Add to validate_metadata_against_dataset (or a new offline test) the assertion n_channels == sum(channel_types.values()) == len(sensors), skipping the fields a dataset legitimately leaves unset.
Call it from a test that runs without --dl-data, so it covers all ~147 datasets on every PR.
Fix the 34 offenders. Most look like n_channels counting EEG only while channel_types/sensors include EOG/EMG/misc — worth settling which convention is intended and writing it down. moabb/tests/test_metadata.py:43 implies n_channels == sum(channel_types), and test_n_channels_matches_raw_data counts every non-stim channel, which agrees.
Note this is offline-checkable, so it is not affected by #1162 — but #1162 is why the data-backed version of this check (test_metadata_matches_raw_data) has also never run.
Verification
frommoabb.datasets.utilsimportdataset_list# 147 metadata blocks checked; 34 mismatch on both comparisons
Activity
Derive n_channels from channel_types, and fix the download job's path
bruAristimunha commentedon Aug 26, 2026
Fixed in #1161 (
7c10845).Derive n_channels from channel_types, and fix the download job's path
Derive n_channels from channel_types instead of storing it
Derive AcquisitionMetadata.n_channels from channel_types instead of s…