Skip to content

Add MI archive datasets: Brodu2012, IMUMIA2026, Leeuwis2021, MartinezPeon2024 and PardoGarcia2026 - #1193

Merged
bruAristimunha merged 24 commits into
NeuroTechX:developfrom
bruAristimunha:datasets/mi-archive-b-20260929
Oct 4, 2026
Merged

bruAristimunha merged 24 commits into
NeuroTechX:developfrom
bruAristimunha:datasets/mi-archive-b-20260929

Conversation

@bruAristimunha

@bruAristimunha bruAristimunha commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Port five existing dataset implementations from the MI expansion branches onto current develop (18e7d4c): Brodu2012 (was OpenViBE), IMUMIA2026 (was Li2026), Leeuwis2021, MartinezPeon2024, PardoGarcia2026. All five loader files are identical between codex/mi58-corrected-20260801 and bruaristimunha-fork/codex/mi-dataset-expansion; no conflicting scientific variant was silently chosen.

  • Register classes, API docs, summary CSV and every cited DOI; migrate acquisition channel counts to current channel_types conventions.
  • Leeuwis: fix inclusive final-trial endpoint to 4.996 s; annotate stored-window joins and preserve EDGE boundary through annotation reconstruction. Synthetic independent-window filtering regression.
  • Li: numeric subject sorting (01,50,100,150,200), archive transport/missing-task checks, synthetic Curry float32/sidecar regression.
  • MartinezPeon: propagate verbosity; synthetic SI scaling and first/last cues. Correct summary total to 300 (not multiplied by run count again).
  • OpenViBE: support both reference-header spellings; synthetic CSV event/scaling test. Remove inherited fake EXEMPT ID.
  • PardoGarcia: preserve genuine missing-post sessions, repair stale BrainVision sibling reference without overwriting originals, retain restricted pre-execution window. Remove inherited fake EXEMPT ID. Summary per-subject mean is protocol-derived across available sessions, not a measured inventory.

Draft blockers — do not merge

  1. No verified NEMAR/OpenNeuro mirror ID/version for any of these five. Inspected public nemarDatasets repository metadata (787 repositories) and OpenNeuro name searches; no matching identity found. This is discovery evidence, not proof no unindexed/private mirror exists. No ID was fabricated and no exemption/pending entry was added. The existing NEMAR validation intentionally still fails for these five. Original upstream transport remains; no rehost/publication occurred.
  2. Real-data validation pending: no recordings downloaded and no Voyager jobs/paper reruns launched in this port. Synthetic tests validate code behavior, not scientific provenance or source calibration.
  3. Li2026 laterality and timing: numeric code-to-side mapping inferred from documented condition ordering, not an explicit codebook; imagery onset relative to cue needs confirmation. Legacy fallback assumes float32 microvolt payload and does not recover physical electrode coordinates. Native-reader/fallback parity needs real source evidence.
  4. PardoGarcia2026: image-locked preparation/imagery cannot be certified as pure MI solely by ending before a go cue. Verify instructions and earliest go cue across all sessions; labels and acquisition semantics remain scientific review gates.
  5. OpenViBE: 14 records are currently exposed as subjects; independent participant identities must be established before cross-subject conclusions. Verify Event Date vs CSV row alignment and source physical units.
  6. MartinezPeon2024: fixed protocol-derived cues rather than recorded markers, recording/block-level force classes and source units require independent verification; avoid claiming acquisition-block-independent decoding.
  7. Leeuwis2021: source units, retained counts and all released timestamp windows require real-file confirmation.

Verification

All tests use explicit PYTHONPATH pointing to this worktree (verified moabb.file), isolated _MNE_FAKE_HOME_DIR, existing MNE_DATA and MOABB_DOWNLOAD_PROVIDER=auto. No signal downloads.

  • Synthetic loaders + metadata + cached DOI + preprocessing: 1099 passed, 358 skipped, 152 deselected.
  • Bounded dataset suite: 1152 passed, 103 skipped, 337 deselected.
  • Genuine missing-ID gate: 5 failed, one per added loader; not suppressed in repository tests.
  • Touched-file pre-commit: passed after formatting.
  • Excluded local network/real-data paths: download-marked tests, test_epochs, test_dataset_accept, four session-filtering tests with potential inherited prefetch; live test_dois_resolve. Missing-ID tests run separately, as above.

Draft only; no merge or all-green CI claim.

Simplification (2026-09-29, head ef9c8a702)

Depends on #1200. Merge #1200 (mne>=1.13, shared download/marker helpers, OpenNeuro mirror mixin) first. This branch merges it (git merge --no-ff, no rebase).

Pass 4 (ponytail): reuse existing code, no nested functions (head e214e4ee2)

  • Merges refactor(datasets): require mne>=1.13, spell colin27 montages, share loader code #1200 at 058ae05e6, which now requires mne>=1.13 and drops the pass-3 helpers that re-implemented existing code.
  • Li2026 downloads through develop's download_and_extract_subject_zip, behind the same extracted-folder check its ten develop callers use. The archive now extracts into MNE-li2026-data/, not next to the cached archive.
  • PardoGarcia2026 reads BrainVision with mne.io.read_raw_brainvision(..., overrides={"data_fname": ..., "marker_fname": ...}), which replaces the header-rewriting read_raw_brainvision_repaired.
  • Leeuwis2021 marks its trial joins with mne.Annotations(onsets, 0.0, "EDGE boundary") directly.
  • Montage names are spelled colin27_1005/colin27_1020 directly.
  • Li2026's nested Curry sidecar parsers (parameter, labels) and its sorted(key=lambda ...) are now module-level private functions.
  • The tests replace the nested data_dl recorder and every monkeypatched lambda with Mock, and read the call flags from call_args_list.
  • Nested functions/lambdas added by this PR: 12 (3 nested defs, 6 patch lambdas, 2 argument lambdas, 1 sort key) → 0.
  • LOC added vs refactor(datasets): require mne>=1.13, spell colin27 montages, share loader code #1200: moabb/datasets/*.py 1289 → 1287; moabb/tests/*.py (net) 211 → 225. The test file grew because of the Mock call-argument assertions and the new overrides check.
  • Behaviour:
    • The class fingerprint (metadata/summary/DOI) is identical.
    • The loader fingerprint is identical apart from the recorded data_dl calls, where Li2026's one call now carries an explicit fname=None. It covers fake CSV/TXT/CSV.bz2/Curry archives through the real loaders, and pybv BrainVision files including one header with a stale MarkerFile.
  • Coverage (pass 3 → pass 4): leeuwis2021 95→95, li2026 81→82, martinezpeon2024 92→92, openvibe 92→92, pardogarcia2026 100→100.
  • Proof: the offline suite (PR tests, test_loader_utils.py, test_preprocessing.py, test_datasets.py, test_metadata.py, test_doi_validation.py) ran 2555 passed and 0 failed. ruff 0.15.20 and git diff --check are clean.

Pass 3: shared helpers, NEMAR skip, new montage names (head 47bde2c9b)

  • Li2026 extracts through download_and_extract_zip. With force_update=True it now also re-extracts; before, it only re-downloaded.
  • PardoGarcia2026's own _read_brainvision is replaced by read_raw_brainvision_repaired (lenient mode). Its header-repair test moved to refactor(datasets): require mne>=1.13, spell colin27 montages, share loader code #1200.
  • Leeuwis2021 uses edge_boundary_annotations.
  • The preprocessing.py change is now owned by refactor(datasets): require mne>=1.13, spell colin27 montages, share loader code #1200.
  • The montage calls in Leeuwis, MartinezPeon, OpenViBE and Pardo use resolve_montage_name.
  • Two small loader tests were added (Pardo _load_raw channel/cue standardisation, Li2026 per-task cue labels). The moved code had been lowering these files' coverage.
  • NEMAR: added to NEMAR_ID_EXEMPT (# no public NEMAR mirror yet; tracked in #1193): Leeuwis2021, Li2026, MartinezPeon2024, OpenViBE, PardoGarcia2026. No ids were invented, NEMAR_ID_PENDING is untouched, and test_all_datasets_have_valid_nemar_id passes locally.
  • LOC added, measured against refactor(datasets): require mne>=1.13, spell colin27 montages, share loader code #1200 (i.e. after it merges): moabb/datasets/*.py 1329 → 1289 (-3%); moabb/tests/*.py (net) 200 → 211 (+6%; includes the NEMAR-exempt lines).
  • Coverage (pass 2 → pass 3, offline suite + test_loader_utils.py): leeuwis2021 95→95, li2026 70→81, martinezpeon2024 92→92, openvibe 92→92, pardogarcia2026 83→100. No touched file dropped by more than 2 pp.
  • Behaviour: Fingerprints (class metadata/summary/DOI + fake data through the real loaders) identical to pass 2.
  • Proof: offline pytest <PR tests> test_loader_utils.py test_preprocessing.py test_datasets.py test_metadata.py test_doi_validation.py --cov=moabb/datasets (isolated MNE home, empty MNE_DATA, no downloads; test_dataset_accept and TestData::test_epochs deselected): 0 failed. Also ruff 0.15.20 and git diff --check.
added LOC vs develop before after pass 1 after pass 2
moabb/datasets/*.py 2009 2009 1329 (-34%)
moabb/tests/*.py (net) 254 201 200 (-21%)

PR tests collected (pass 2): 12 → 13. Coverage of touched dataset files (pass-1 before → now, offline suite): leeuwis2021 89→95, li2026 67→70, martinezpeon2024 77→92, openvibe 88→92, pardogarcia2026 74→83, preprocessing 40→40.

Pass 2 — loaders and tests

  • 5 hand-written summary tables removed; compact channel lists; docstrings to MOABB's usual 1–2 paragraphs (all references/DOIs kept)
  • Leeuwis SUBJECTS derived from the file-id table keys (55-line list removed); MartinezPeon file-id table one line per subject (ids unchanged), runtime assert in _read_run dropped (next line set_montage(on_missing='raise') already fails loudly)
  • Li2026 four parallel task tables → one; OpenViBE Ref_Nose→Nz rename simplified (+1 two-case test for both header spellings), montage try/except dropped; Pardo single-use download helper inlined
  • Kept on purpose: Li2026 Curry-less fallback reader and missing-task error, Pardo PAC03-POST header repair, all ids/URLs/events/intervals.
  • Proof: offline pytest <PR tests> test_datasets.py test_metadata.py test_doi_validation.py --cov=moabb/datasets (isolated MNE home, no downloads; test_dataset_accept/TestData::test_epochs deselected); behaviour fingerprint before/after on fake source data (per-run data hash, channels/types, sfreq, annotations, events, montage) and class fingerprint (subjects, sessions, event_id, interval, code, DOI, METADATA hash, summary-CSV row, docstring DOIs) identical except Dataset summary rendered once instead of twice; ruff 0.15.20, git diff --check.
  • Unchanged and expected: Test_Datasets::test_all_datasets_have_valid_nemar_id[<new classes>] fails (no nemar_id, not in NEMAR_ID_PENDING) — NEMAR-ID decision still open.

Pass 1 — test audit

  • test_li2026_regression.py, test_openvibe_regression.py, test_pardogarcia2026_regression.py merged into test_archive_b_regression.py; the copied dl.data_dl recorder is now one helper (_capture_transport).
  • Removed: test_pure_imagery_window_precedes_overt_execution (restated interval/event_id/rename table and grepped docstring strings — owned by test_datasets.py summary/metadata checks); the Leeuwis whole-raw-vs-per-crop filter comparison (verified MNE's EDGE handling, not moabb — the EDGE-survives-SetRawAnnotations, first/last cue and 2×1250-sample assertions stay); test_pardo_missing_post_is_not_duplicated[11] (same single-session path as patient 2); preload/verbose call-shape asserts in the fake reader.
  • Tests collected 14 → 12; test LOC 254 → 201 (−21%). Coverage: leeuwis2021 89→89%, li2026 67→67%, martinezpeon2024 77→77%, openvibe 88→88%, pardogarcia2026 74→74%, preprocessing 40→40%. Proof: offline pytest <PR tests> moabb/tests/test_datasets.py moabb/tests/test_metadata.py moabb/tests/test_doi_validation.py --cov=moabb/datasets --cov-report=term-missing -p no:cacheprovider (isolated MNE home, no downloads; test_dataset_accept/TestData::test_epochs deselected). Pre-existing on this branch, untouched: Test_Datasets::test_all_datasets_have_valid_nemar_id[<new classes>] fails (no nemar_id, not in NEMAR_ID_PENDING).

…>79.0%)

Merge the four archive-B regression modules into test_archive_b_regression.py
with a shared _capture_transport helper (the data_dl recorder was copied in
two files). Drop test_pure_imagery_window_precedes_overt_execution (restated
interval/event_id/constant dict and grepped docstring/metadata strings), the
MNE filter-independence block of the Leeuwis test (exercised MNE, not moabb),
and the redundant control-subject param of the PardoGarcia session test.

Per-file coverage (before -> after): leeuwis2021 89->89, li2026 67->67,
martinezpeon2024 77->77, openvibe 88->88, pardogarcia2026 74->74.
Test LOC added vs develop: 254 -> 201; PR tests collected: 14 -> 12.
- resolve_montage_name (moabb.datasets._montage, re-exported by utils): MNE 1.13
  renamed standard_1005/1020 (and the other standard_* templates) to colin27_*,
  warns on the old names and 1.14 removes them. Returns the spelling the installed
  MNE knows; electrode files are byte-identical (dig positions checked equal on
  MNE 1.10.2, 1.12.1 and 1.13.2). Every make_standard_montage/set_montage call in
  moabb now goes through it; METADATA montage labels are descriptive and unchanged.
- download_and_extract_zip: download once, extract unless a marker exists,
  optional warn + forced re-download of a corrupted archive.
- read_raw_brainvision_repaired: repair stale DataFile/MarkerFile references in a
  temporary header (strict mode raises on missing entries/siblings).
- rename_stimulus_codes, edge_boundary_annotations; SetRawAnnotations keeps
  'EDGE boundary' markers.
- moabb.datasets._openneuro_mirror moved here verbatim (byte-identical copies in
  NeuroTechX#1186 and NeuroTechX#1189), with dataset-agnostic tests.
…e-b-20260929

# Conflicts:
#	docs/source/whats_new.rst
#	moabb/datasets/preprocessing.py
…tage names

Merges NeuroTechX#1200 (datasets/shared-loader-helpers): local zip/BrainVision/EDGE-boundary
code replaced by moabb.datasets.utils helpers, montage calls spelled with the
MNE 1.13 colin27_* names via resolve_montage_name, new classes without a public
NEMAR mirror listed in NEMAR_ID_EXEMPT. Behaviour fingerprints unchanged.
MNE 1.13 renamed the standard_* templates to colin27_* (identical .elc
files). With the floor at 1.13 the resolve_montage_name shim and the
_montage module are not needed: every call site spells the new name.
- download_and_extract_zip -> extend download_and_extract_subject_zip with
  keyword-only fname and redownload_corrupted (defaults keep the 10
  develop callers unchanged)
- read_raw_brainvision_repaired -> mne.io.read_raw_brainvision(overrides=)
  at the call sites (MNE >= 1.13)
- edge_boundary_annotations -> mne.Annotations(onsets, 0.0, 'EDGE boundary')
- drop_native_stim / relabel_annotations / write_dataset_description ->
  drop_channels / annotations.rename / mne_bids.make_dataset_description
- tests: no nested functions, Mock data_dl
…e-b-20260929

# Conflicts:
#	docs/source/whats_new.rst
…overrides

- download_and_extract_zip -> develop's download_and_extract_subject_zip
  behind the usual extracted-folder check (Li2026)
- read_raw_brainvision_repaired -> mne.io.read_raw_brainvision(overrides=)
  (PardoGarcia2026)
- edge_boundary_annotations -> mne.Annotations(onsets, 0.0, "EDGE boundary")
  (Leeuwis2021)
- colin27_* montage names spelled directly (mne>=1.13)
- Li2026: nested Curry sidecar parsers and sort key hoisted to module level
- tests: Mock instead of monkeypatched lambdas and nested transport
…r audit)

needs_real_data_check

The author-deposited open-access copy of Brodu et al. (2012) (HAL
inria-00632546, section 4.1.4 "OpenViBE / INRIA data (1 subject)") states:
"This data set comprises EEG signals from a single subject for which 560
trials of motor imagery (280 trials per class) were recorded over a 2 week
period." 14 records x 40 trials (20 per class) = 560, so the 14 records of
"Dataset #1 - Motor Imagery of Hands" on openvibe.inria.fr are 14 recordings
of ONE subject, not 14 subjects.

Loader behaviour change: subjects=[1], one session, one run per record
(14 runs, keys "0".."13"); data_path returns the 14 record files.
n_subjects 14 -> 1, trials_per_class 20 -> 280, runs_per_session=14; summary
CSV updated (1 subject, 280 trials/class, 14 runs, 560 total). The synthetic
regression tests were updated (transport count 14; session/run layout).

Also from the sources: reference "nose reference electrode" (paper) vs
"recorded in common average mode and Nz can be used as a reference"
(download page) - both documented; institution "INRIA ... Rennes-Bretagne
Atlantique"; publication_year 2012 (paper; page: recorded 2008/03, uploaded
2010/03); licence wording "can be downloaded for free in the hope that they
can help research".

Evidence: ~/Projects/moabb/.paper-audit/reports/mi-archive-b/OpenViBE/report.md,
~/Projects/moabb/.paper-audit/OpenViBE/paper-10_1016_j_neucom_2011_10_010.txt,
~/Projects/moabb/.paper-audit/OpenViBE/repo/openvibe_inria_datasets/landing_page.txt
…per audit)

Sources: Zenodo record description, the companion Research Square preprint
on the same cohort (10.21203/rs.3.rs-6958817/v1) and the CASEIB 2023
proceedings paper (10.31428/10317/13645); both DOIs tracked in
related_paper_dois and added to doi_cache.json via test_dois_resolve.

- reference: "with A2 as reference" (preprint; CASEIB: "incluyendo el
  mastoides ... como referencia"); cap "64-channel Ag/AgCl electrode cap
  (Electro-Cap International)"; line_freq 50 Hz ("notch filtering (50 Hz)").
- institution: "Instituto Pluridisciplinar, Universidad Complutense de
  Madrid" (recording site), Universidad Politecnica de Madrid, Hospital
  Clinico San Carlos; the previously listed UNED appears in no source.
- docstring: paper-vs-release note - record says "7 right-handed healthy
  controls" and "64-channel system" while the release holds eight control
  recordings and 63 header channels; n_subjects stays 18 (release).

Evidence: ~/Projects/moabb/.paper-audit/reports/mi-archive-b/PardoGarcia2026/report.md
The Zenodo description reads "synchronized EEG and EMG data from 244
participants" and names the dataset "The IMU-MI_A dataset"; the module said
242 in three places (no source supports 242). n_subjects stays 5 (the public
five-subject sample loaded by MOABB), now stated explicitly in the docstring.

Evidence: ~/Projects/moabb/.paper-audit/reports/mi-archive-b/Li2026/report.md
…paper audit)

Source: the open-access (CC BY) J. Neural Eng. article, fetched from IOP.

- reference: "with P3 and P4 as reference locations, according to the
  International 10-20 System".
- participants: "ten participants (seven males, aged 27.8 +- 2.78, range
  24-32 years)".
- institution: TecNM - IT Nuevo Leon and Cinvestav Saltillo (affiliations);
  country MX confirmed ("Guadalupe, Mexico", "Saltillo, Mexico").
- line_freq 60 Hz supported ("followed by a 60 Hz notch filter").
- docstring: full citation of the article as [2].

Evidence: ~/Projects/moabb/.paper-audit/reports/mi-archive-b/MartinezPeon2024/report.md
OpenViBE is the software platform/hosting project, not a dataset name: the
download page lists the data only as "Dataset #1 - Motor Imagery of Hands"
and the primary paper, "Exploring two novel features for EEG-based
brain-computer interfaces: Multifractal cumulants and predictive
complexity" (Nicolas Brodu, Fabien Lotte, Anatole Lecuyer; Neurocomputing
79, 2012, 10.1016/j.neucom.2011.10.010), refers to it as "OpenViBE / INRIA
data" describing "a single subject for which 560 trials of motor imagery
(280 trials per class) were recorded". Rule 2 gives FirstAuthorYear of the
primary paper: Brodu2012. Renamed class, module, code, registry, api.rst,
whats_new, summary CSV, tests and the NEMAR exemption list; the remaining
"OpenViBE" mentions describe the software, mirror and repository. No
deprecated alias (the name was never released).
The authors present IMU-MI_A as the dataset's name in the record prose:
the Zenodo 20421767 description opens "The IMU-MI_A dataset is a unique
large-scale motor imagery resource supporting cross-paradigm studies of
temporal brain dynamics" and closes "IMU-MI_A provides a valuable resource
for the BCI and neuroscience communities" (record title "A Human Motor
Imagery EEG Dataset Covering Diverse Cognitive States and Neural Response
Patterns", creators jianxiu li, changming wang, chao chen, 2026; no paper).
Rule 1 gives the official name with hyphen/underscore removed plus the
record year: IMUMIA2026. Renamed class, module, code, registry, api.rst,
whats_new, summary CSV, tests and the NEMAR exemption list; no deprecated
alias (the name was never released).
@bruAristimunha bruAristimunha changed the title Add MI archive datasets: Leeuwis, Li, MartinezPeon, OpenViBE and PardoGarcia Add MI archive datasets: Brodu2012, IMUMIA2026, Leeuwis2021, MartinezPeon2024 and PardoGarcia2026 Sep 30, 2026
bruAristimunha and others added 3 commits October 4, 2026 17:55
The Zenodo release (10.5281/zenodo.20421767) ships purely numeric per-task
.cdt file names (e.g. task1/0101001.cdt, task5/01020200.cdt), not the
Sub_NN.cdt layout the loader assumed. The 'Sub_(\\d+)' regex therefore
raised AttributeError('NoneType') on every real file and get_data()
failed before any Curry read.

Within each task directory every file has the same digit count and the
only varying field is the subject's ordinal position in the five-subject
sample, so a plain lexicographic sort reproduces the authors' order and
maps subject n (1..5) to the n-th file. The synthetic archive test is
updated to the real naming.
@bruAristimunha
bruAristimunha marked this pull request as ready for review October 4, 2026 17:30
@bruAristimunha
bruAristimunha merged commit 1c45ef9 into NeuroTechX:develop Oct 4, 2026
10 of 11 checks passed
@bruAristimunha
bruAristimunha deleted the datasets/mi-archive-b-20260929 branch October 6, 2026 10:18
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.

1 participant