Skip to content

[Release readiness] Stream 9: Importers #554

Closed

Description

@suraj-ranganath

[Release readiness] Stream 9: Importers

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: Importers and dataset files (size L). Findings assigned: F10, F15, F18, F19, F20, F21, F22, F23, F26, F34, F119.

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

menu_actions.py: _import_dataset, _open_import_filename, _import_current_dataset_metadata (519-623); popfunc/pop_importdata.py, pop_biosig.py, pop_importevent.py, pop_importepoch.py, pop_chanevent.py, pop_fileio.py, pop_loadcnt/pop_readegi wiring, pop_fileio_mff.py; popfunc/pop_loadset.py; guifunc/file_dialogs.py (MFF folder selection); pop_saveset.py (F26 only); pyproject.toml/uv.lock (defusedxml)

Dependencies / merge order: Merge after S1 (pop_saveset.py; menu_actions import region sits next to S1's save region). Owns pyproject.toml; coordinate F53 (S8).

Suggested tests from the stream plan: Qt tests for each options dialog; function tests per reader; MATLAB parity on jamming for importdata/importevent/importepoch/chanevent (pinned) and readers via the non-pinned plugins (neuroscanio, bva-io, Fileio).

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-09/ 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).

- [ ] F10 — high — File > Import

Finding (full audit text): Import items open a file picker only, with none of EEGLAB's option dialogs. pop_importdata asks only for the sampling rate (default 1.0; EEGLAB has ~19 fields). pop_biosig has no channel/range/event/ref options. mff/CNT/.EEG go to the generic pop_fileio (pop_loadcnt/pop_readegi exist but are not wired). pop_loadbv has no dialog. pop_importevent is fixed to append=no with no fields/skipline/timeunit/align. pop_importepoch/importpres/importerplab: picker only. pop_chanevent: channel index only

Evidence / screenshots: menu_actions.py 519-621 (hands-on confirmed Nov 4; see F18-F24)

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.

- [ ] F15 — high — File > Load existing

Finding (full audit text): HDF5/v7.3 .set (eeglab_data_hdf5.set) fails to load in eegprep; EEGLAB at the pin loads it (32 x 30504)

Evidence / screenshots: mlout/log.txt 'hdf5 OK 32 30504'; screenshots/F15_eegprep.png (error box says only "no default reduce due to non-trivial cinit": h5py Reference deepcopy)

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):

  • F15_eegprep.png — F15: eegprep

- [ ] F18 — high — File > Import > MFF

Finding (full audit text): MFF can't be imported from the GUI: the Qt file dialog goes into the .mff directory and can't select it, so Open stays disabled. The API fails too (missing defusedxml dependency). Stock pinned EEGLAB asks to install mffmatlabio (Yes/No)

Evidence / screenshots: ep_mff_dialog*.png, ml_mff*.png; screenshots/F18_eegprep.png, F18_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):

  • F18_eeglab.png — F18: EEGLAB
  • F18_eegprep.png — F18: eegprep

- [ ] F19 — medium-high — File > Import event info

Finding (full audit text): Accepts tutorial_eventtable.txt (capitalised Latency/Type) and silently makes 100 events with no latency field. EEGLAB pop_importevent requires a lowercase latency field and errors ("Cannot add new field to event structure") without explicit fields. events_simple.txt with header: eegprep auto-uses the header; output matches EEGLAB with fields {type latency duration}, skipline 1, timeunit 1 EXACTLY (30 events, latency 257, data identical). No options dialog in eegprep; EEGLAB has Event indices, Append (unchecked=overwrite), field names, header lines, time unit, align, auto-adjust srate

Evidence / screenshots: compare_file_out.txt, ml_importevent*.png; screenshots/F19_eegprep.png, F19_evidence.png, F19_eeglab.png (EEGLAB options dialog)

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):

  • F19_evidence.png — F19: evidence
  • F19_eeglab.png — F19: EEGLAB
  • F19_eegprep.png — F19: eegprep

- [ ] F20 — medium-high — File > Import event info > From data channel

Finding (full audit text): Event TYPES differ from EEGLAB in 132 of 511 events (latencies identical). E.g. the first three types: eegprep [-30.61, -30.61, -23.24], EEGLAB [-30.61, -23.24, -23.24]. eegprep asks for the channel index only; EEGLAB's pop_chanevent dialog has channel(s), transform, up/both/down, transition length, duration, delete channel (default yes), delete old events (default yes), all same type (default no)

Evidence / screenshots: compare_file_out.txt, ep_chanevent_dialog*.png, ml_chanevent*.png; screenshots/F20_eegprep.png, F20_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):

  • F20_eeglab.png — F20: EEGLAB
  • F20_eegprep.png — F20: eegprep

- [ ] F21 — medium — File > Import > ASCII

Finding (full audit text): eegprep asks only for srate (QInputDialog, default 1.0, 1 decimal); EEGLAB pop_importdata has ~19 fields (format, setname, srate 1, pnts 0, xmin 0, nbchan 0, ref, subject/condition/session/group, chanlocs, ICA weights/sphere). Data match (maxdiff 5e-7 = float32 rounding) but eegprep: float64, labels Ch1..Ch4, setname = file stem; EEGLAB: float32, NO chanlocs, empty setname. A transposed file (512x4) errors in eegprep ("pass nbchan", which the GUI can't take); EEGLAB auto-transposes to 4x512. srate 0 -> 1 Hz in both, but eegprep's command records 'srate', 0

Evidence / screenshots: compare_file_out.txt, ep_ascii_.png, ml_importascii.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.

- [ ] F22 — medium — File > Import epoch info

Finding (full audit text): File picker only; EEGLAB has a dialog (file, field names, latency/duration/type fields, time unit 1, header lines 0, remove old info = yes). eegprep auto-detects the header; EEGLAB needs headerlines=1 or it errors. With headerlines 1 the outputs are IDENTICAL (80 'TLE' events, latencies, data)

Evidence / screenshots: compare_file_out.txt, ml_importepoch*.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.

- [ ] F23 — medium — File > Import > CNT/.EEG/BVA

Finding (full audit text): eegprep reads CNT through pop_fileio (2 ch, 25605 pnts, 200 Hz, 11 events, float32); EEGLAB wires pop_loadcnt (neuroscanio). Stock pinned EEGLAB prompts to install neuroscanio/bva-io/mffmatlabio and errors "Cannot find Biosig/Fileio extension" for EDF/BDF/BIOSIG/FILE-IO/Export EDF/Presentation; eegprep needs no install (intentional advantage). BVA: eegprep == EEGLAB pop_loadbv exactly (32 x 2112, 17 events, labels) apart from dtype float64 vs float32

Evidence / screenshots: ml_cnt*.png, ml_vhdr*.png, compare_file_out.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.

- [ ] F26 — medium — File > Save as

Finding (full audit text): eegprep saves one .set file (no .fdt) even when the source dataset was two-file; EEGLAB keeps the two-file layout for a dataset loaded with a datfile (ml_reref_gui.fdt, ml_twofiles.fdt written). A name without an extension: eegprep writes 'noext' with no extension; EEGLAB appends .set. Re-reference GUI loop: eegprep vs EEGLAB saved files match (float32 maxdiff 1.5e-5 = 1 ulp, 154 events, labels, ref=average, setname identical)

Evidence / screenshots: compare_file_out.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.

- [ ] F34 — low — File > Load existing (errors)

Finding (full audit text): Corrupt .set: eegprep says "Unknown mat file type, version 73, 196"; EEGLAB says "Unable to read file". Neither says the file is not a valid dataset. Missing .fdt: EEGLAB's message is helpful (rename/move hint); compare eegprep's

Evidence / screenshots: ep_load_corrupt_error_20261104_231559.png, mlout/log.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.

Screenshots (filenames; attach pending):

  • ep_load_corrupt_error_20261104_231559.png — 34: ep_load_corrupt_error_20261104_231559

- [ ] F119 — high — File > Import data > Neuroscan .EEG

Finding (full audit text): The menu routes to pop_fileio, which uses MNE's BrainVision reader, which errors with 'header file must be given... not .EEG'. The importer is unusable. EEGLAB (Fileio, non-pinned bench) loads 32 ch / 700 pnts / 1193 trials / 1000 Hz / 5960 events.

Evidence / screenshots: F119nseeg_dlg_eegprep_20261105_051022.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):

  • F119nseeg_dlg_eegprep_20261105_051022.png — F119: eegprep

- [ ] F8 — resolved at pin — File > Import (no eegprep code fix expected)

Audit note: (Found against d0963be9; at the pin 8ac485f6 the File menu tree matches item-for-item apart from EEGLAB->EEGPrep branding.) BVA label ".vhdr file" vs ".vhdr or .ahdr file", in a different order; mff/cnt/BVA items carry origin extension:EEG_BIDS

Disposition: Resolved at the pin

What counts as done: Confirm the disposition still holds on current develop. If this was an intentional difference or EEGLAB-only bug, add or keep a short documented note / test so it cannot regress into a silent mismatch. If it was a pass, re-verify once related findings in this stream are fixed. Screenshots named in the audit evidence: menu TSV diff

- [ ] F31 — info (EEGLAB bug) — File > Import event > ERPLAB (no eegprep code fix expected)

Audit note: Pinned EEGLAB: Cancel in pop_importerplab raises "EEGLAB error in pop_importerplab() line 93: Dot indexing is not supported". eegprep has no such error (generic picker)

Disposition: EEGLAB-only bug (Cancel in pop_importerplab); eegprep has no error

What counts as done: Confirm the disposition still holds on current develop. If this was an intentional difference or EEGLAB-only bug, add or keep a short documented note / test so it cannot regress into a silent mismatch. If it was a pass, re-verify once related findings in this stream are fixed. Screenshots named in the audit evidence: ml_erplab_20261104_234918.png

- [ ] F32 — info — File > Load existing (no eegprep code fix expected)

Audit note: EEGLAB's file picker reopens in the last-used folder (option on by default); eegprep: check

Disposition: Info, unverified observation (picker last folder); no difference shown

What counts as done: Confirm the disposition still holds on current develop. If this was an intentional difference or EEGLAB-only bug, add or keep a short documented note / test so it cannot regress into a silent mismatch. If it was a pass, re-verify once related findings in this stream are fixed. Screenshots named in the audit evidence: ml_loadset_picker_lastdir.png

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

Merge after S1 (pop_saveset.py; menu_actions import region sits next to S1's save region). Owns pyproject.toml; coordinate F53 (S8).

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
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