Skip to content

[Release readiness] Stream 10: Export and BIDS #555

Closed

Description

@suraj-ranganath

[Release readiness] Stream 10: Export and BIDS

Context

This issue is one of 11 release-readiness streams for sccn/eegprep. The release goal is EEGLAB parity in the GUI and the numbers for everything except STUDY and third-party plugins (default / bundled plugins only: EEG-BIDS, ICLabel, clean_rawdata, dipfit, firfilt).

The audit (report eegprep_GUI_audit_2026-11-05.pdf, findings F1–F126 in findings.md) was run as a simulated user: hands-on GUI use of eegprep and EEGLAB side by side, with real datasets, plus numerical parity checks against MATLAB EEGLAB. EEGLAB was the pinned tree eeglab-8ac485f6 on the lab MATLAB machine (jamming, path ~/gui-parity/eeglab-8ac485f6), never modified. eegprep was develop at 0bda20da. Where the pinned tree lacked a plugin (Biosig, Fileio, neuroscanio, bva-io, Fieldtrip-lite, viewprops), comparisons against a bench copy are labelled non-pinned.

Of 144 in-scope menu items, 141 were tested hands-on in both GUIs. Not counted in that 141: Quit (not run, ends the session) and the two eegprep-only Plot items "View extended channel/component properties" (pinned EEGLAB has no viewprops; tested in eegprep only as F122).

This stream: Export and BIDS (size M). Findings assigned: F11, F13, F16, F17, F24, F25, F123, F125.

Files / functions owned (do not edit outside these without coordinating; see fix_streams.md):

menu_actions.py: _export_current_dataset (624-670) and _bids_tool_action (937-971); popfunc/pop_export.py, pop_expevents.py, pop_expica.py, pop_writeeeg.py; plugins/EEG_BIDS/* (pop_importbids, pop_exportbids, bids_tools, bids_exporter); popfunc/pop_load_frombids.py

Dependencies / merge order: Independent of S9 (different menu_actions methods). Also fixes the writeeeg LASTCOM history form (part of F49).

Suggested tests from the stream plan: Function tests (EDF round trip with MNE/pyedflib, text export formats); BIDS import parity on jamming with pinned EEG-BIDS (event types, epoching oddball/standard); bids-validator run on the export.

Common datasets used in the audit (copies only; never the originals):

  • eeglab_data.set — continuous tutorial (32 ch, 128 Hz, 30504 pnts)
  • eeglab_data_epochs_ica.set — epoched + ICA (80 epochs)
  • eeglab_data_numerical_events.set — numerical event types
  • BrainVision set (testbva.vhdr / related) — 32 ch, 2112 pnts, 17 events
  • test.bdf / test.edf — Biosemi / EDF samples
  • BIDS oddball sample for import/export
  • Neuroscan .EEG, BVA .mat, MFF folder, HDF5 eeglab_data_hdf5.set where noted
  • Channel location files: eeglab_chan32.locs, standard_1005.elc, standard-10-5-cap385.elp

Companion stream issues (together they cover F1–F126):

Stream Issue
1 Data safety #546
2 Dialogs and Edit selection #548
3 Scroll window #547
4 Signal processing #549
5 Channel locations and re-reference #550
6 Rejection numbers #551
7 Plots and plot history #552
8 ICLabel, component properties, DIPFIT #553
9 Importers #554
10 Export and BIDS #555
11 Main window, menus, preferences, help #556

Screenshots: image files for this stream are staged under /workspace/gui-parity/issues/stream-10/ and ready for gh issue edit --attach. Embedding via --attach failed with the current fine-grained GH_TOKEN (HTTP 403 on uploads.github.com). Run attach_screenshots.sh with a classic PAT that can upload user-attachments (or grant the fine-grained token Contents + attachments). Until then, screenshot filenames are listed under each finding.

Findings

Use the checkboxes to track progress. Full audit detail is carried over (not summarised away).

- [ ] F11 — medium — File > Export

Finding (full audit text): Export items open a save picker only. pop_export is fixed to transpose=on (no ICA, time, precision or separator options). pop_expica/expevents/writeeeg take no options. pop_exportbids asks only for a directory (EEGLAB has a 9+ field dialog)

Evidence / screenshots: menu_actions.py ~624-669

What needs fixing: Resolve the behaviour so eegprep matches EEGLAB for this item (GUI and numbers), unless EEGLAB is the buggy side — then keep the correct behaviour, document the difference, and lock it with a test. Add a regression test. Keep existing tolerances.

- [ ] F13 — medium (unverified) — File > BIDS tools

Finding (full audit text): pop_taskinfo/participantinfo/eventinfo have no DialogSpec; EEGLAB dialog-label coverage 0/29, 1/26, 0/7. Likely big dialog gaps; needs hands-on

Evidence / screenshots: inventory.csv

What needs fixing: Resolve the behaviour so eegprep matches EEGLAB for this item (GUI and numbers), unless EEGLAB is the buggy side — then keep the correct behaviour, document the difference, and lock it with a test. Add a regression test. Keep existing tolerances.

- [ ] F16 — high — File > Import > From BIDS / Save

Finding (full audit text): A dataset imported From BIDS can't be saved: "Could not convert None (type NoneType) to array" (EEG.chaninfo.plotrad/shrink are None), and a partial 1.1 MB file is left behind. From BIDS also loads one dataset straight away. EEGLAB: folder picker, then the pop_importbids options dialog, then a STUDY

Evidence / screenshots: ep_bids_save_error*.png, out/ep_bids.set, ml_bidsimport*.png; screenshots/F16_eegprep.png, F16_eeglab.png

What needs fixing: Resolve the behaviour so eegprep matches EEGLAB for this item (GUI and numbers), unless EEGLAB is the buggy side — then keep the correct behaviour, document the difference, and lock it with a test. Add a regression test. Keep existing tolerances.

Screenshots (filenames; attach pending):

  • F16_eeglab.png — F16: EEGLAB
  • F16_eegprep.png — F16: eegprep

- [ ] F17 — high — File > Export > EDF

Finding (full audit text): pop_writeeeg on the BrainVision set keeps only 11 of 17 events (every event after ~6.6 s is lost; checked with MNE and pyedflib); pnts padded 2112->2200; data maxdiff 4.4e-4. The EEGLAB-side round trip was not run (bench Biosig sopen failed on jamming; stock pin has no Biosig)

Evidence / screenshots: out/ep_bva_export.edf; screenshots/F17_eegprep.png, F17_evidence.png (re-run 01:03 PST: 11/17 annotations, 2200 samples; history string is "LASTCOM = pop_writeeeg(...)")

What needs fixing: Resolve the behaviour so eegprep matches EEGLAB for this item (GUI and numbers), unless EEGLAB is the buggy side — then keep the correct behaviour, document the difference, and lock it with a test. Add a regression test. Keep existing tolerances.

Screenshots (filenames; attach pending):

  • F17_evidence.png — F17: evidence
  • F17_eegprep.png — F17: eegprep

- [ ] F24 — medium — File > Export (text)

Finding (full audit text): No option dialogs (EEGLAB pop_export: ICA, ERP, transpose=on, labels=on, csv, time=on unit 1E-3, 4 sig. digits, expr). Values match, formatting differs: data %.7g (eegprep) vs %.7f (EEGLAB); weights %.18e tab-separated vs %15.7e space-aligned; events: eegprep columns alphabetical, no 'number' column, adds duration; EEGLAB number/type/position/latency/urevent/epoch

Evidence / screenshots: out/ep_.txt vs mlout/ml_.txt, ml_exportdata*.png

What needs fixing: Resolve the behaviour so eegprep matches EEGLAB for this item (GUI and numbers), unless EEGLAB is the buggy side — then keep the correct behaviour, document the difference, and lock it with a test. Add a regression test. Keep existing tolerances.

- [ ] F25 — medium — File > Export > BIDS

Finding (full audit text): eegprep exports a single dataset (EEGLAB pop_exportbids refuses: "BIDS export can only export EEGLAB studies"). Output lacks the required _eeg.json, README and electrodes.tsv; events trial_type is written as "1.0"; eegprep Validate BIDS still says 0 errors / 0 warnings (EEGLAB opens the online bids-validator). Task/participant/event info are free-text key=value boxes stored in EEG.etc.bids; EEGLAB pop_taskinfo is a large form (Name, TaskName, Cap, EEGReference*...), and participant info first asks for a Subject code. The BIDS export wizard is just a folder picker in eegprep; EEGLAB shows a welcome/Continue wizard

Evidence / screenshots: ep_bids_export_first*.png, ep_bids_validate_result*.png, ml_bidsexport*.png, ml_wizard*.png, ml_taskinfo*.png

What needs fixing: Resolve the behaviour so eegprep matches EEGLAB for this item (GUI and numbers), unless EEGLAB is the buggy side — then keep the correct behaviour, document the difference, and lock it with a test. Add a regression test. Keep existing tolerances.

- [ ] F123 — high (blocker for BIDS workflows) — File > Import data > BIDS (pop_importbids)

Finding (full audit text): No options dialog (EEGLAB shows one). Dims match: 79 ch / 194048 / 863 events. But event type is taken from trial_type ('stimulus'/'response'/'nan'); EEGLAB uses the value column (oddball/standard/noise...). Epoching oddball/standard on eegprep's import gives 'empty epoch range'. (EEGLAB friction: the first pop_importbids failed in orderfields, the retry worked.)

Evidence / screenshots: F123bidsev_eegprep_20261105_054225.png, P_E2Ea_bids_dlg_eegprep_20261105_054100.png, E2Ea_bids_dlg_eegprep_20261105_054142.png, E2Ea_bids_opts_eegprep_20261105_054200.png, P_F123epoch_dlg_eegprep_20261105_054434.png

What needs fixing: Resolve the behaviour so eegprep matches EEGLAB for this item (GUI and numbers), unless EEGLAB is the buggy side — then keep the correct behaviour, document the difference, and lock it with a test. Add a regression test. Keep existing tolerances.

Screenshots (filenames; attach pending):

  • P_E2Ea_bids_dlg_eegprep_20261105_054100.png — F123: eegprep
  • P_F123epoch_dlg_eegprep_20261105_054434.png — F123: eegprep
  • E2Ea_bids_dlg_eegprep_20261105_054142.png — F123: eegprep
  • E2Ea_bids_opts_eegprep_20261105_054200.png — F123: eegprep
  • F123bidsev_eegprep_20261105_054225.png — F123: eegprep
  • F123epoch_types_eegprep_20261105_054444.png — F123: eegprep

- [ ] F125 — low — File > Export > Data to text file (precision)

Finding (full audit text): precision=7 writes 7 significant digits; EEGLAB writes 7 decimals.

Evidence / screenshots: fout/e2eb_export_eegprep.txt vs fout/e2eb_export_eeglab.txt

What needs fixing: Resolve the behaviour so eegprep matches EEGLAB for this item (GUI and numbers), unless EEGLAB is the buggy side — then keep the correct behaviour, document the difference, and lock it with a test. Add a regression test. Keep existing tolerances.

Definition of done

  • Every finding checkbox in this issue is fixed (or explicitly documented as intentional / EEGLAB-only with a locked test).
  • A regression test exists for each finding (Qt offscreen and/or function test as appropriate for the stream).
  • Where numbers are involved: a numerical parity test against pinned EEGLAB eeglab-8ac485f6 on jamming. Do not loosen any existing tolerance — only Suraj or Arno may change tolerances; fix root causes instead.
  • Where EEGLAB itself is buggy: eegprep does the right thing; the difference is documented and locked with a test (documented-difference style).
  • Error messages state what is wrong, which function hit it, and the exact fix (e.g. the pip install eegprep[...] command).
  • No code comments that restate code or justify workarounds.
  • Changelog entry for the stream.
  • One PR against develop, CI green (ignore the known-broken Claude review check).
  • Before merge, retest the same way as the audit: each finding's GUI flow is re-run hands-on in both eegprep and EEGLAB side by side, with before/after screenshots, plus the MATLAB parity / reference checks where this stream requires them; post the results on the PR.
  • Merging requires Suraj's explicit approval (squash merge).

Dependencies and overlaps

Independent of S9 (different menu_actions methods). Also fixes the writeeeg LASTCOM history form (part of F49).

Shared hotspots (from fix_streams.md):

  • menu_actions.py is split by method — only edit this stream's named methods.
  • tests/eeglab_python_backend_xfails.py and tests/parity_expected/: each stream adds/removes only its own entries.
  • Suggested merge order overall: S1 → S2/S9/S11 → S5; S7 → S8; S3/S4/S6/S10 independent.

References

  • Audit PDF: eegprep_GUI_audit_2026-11-05.pdf (Suraj / Arno)

  • Findings log: findings.md (F1–F126)

  • Stream plan: fix_streams.md

  • Pinned EEGLAB: eeglab-8ac485f6

Activity

  1. added
    bug
    epic
    on Nov 5, 2026
  2. suraj-ranganath commented on Nov 11, 2026

    @suraj-ranganath
    MemberAuthor

    All eight findings (F11, F13, F16, F17, F24, F25, F123, F125) landed in #562 (9364de6) with tests in tests/test_stream10_export_bids.py. The remaining in-memory None coordinates for unlocated BIDS channels are tracked in #538. Closing.

  3. arnodelorme commented on Dec 1, 2026

    @arnodelorme
    Collaborator

    🤖 The new pop_writeeeg layout finding is tracked in #952. PR #951 includes the actual MATLAB and Qt captures and the same-input numerical comparison.

  4. arnodelorme commented on Dec 1, 2026

    @arnodelorme
    Collaborator

    🤖 The new pop_exportbids layout finding is tracked in #999. PR #997 includes the actual MATLAB and Qt captures and the same-input numerical comparison.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugepic

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions