Repository navigation
Description
[Release readiness] Stream 5: Channel locations and re-reference
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: Channel locations and re-referencing (size M). Findings assigned: F12, F36, F43, F45, F46, F61, F62, F70.
Files / functions owned (do not edit outside these without coordinating; see fix_streams.md):
popfunc/pop_chanedit.py (spec and actions); sigprocfunc/readlocs.py, convertlocs.py; popfunc/pop_readlocs.py, pop_writelocs.py; popfunc/pop_reref.py; qt.py _validate_pop_reref_dialog only if needed (coordinate with S2)
Dependencies / merge order: Merge after S1 (navigation helper) and S2 (generic button callback). F45/F46/F62 numerics can start now; wire the F36 buttons after S2 merges. Also fixes the chanedit history form (part of F49).
Suggested tests from the stream plan: Function tests for lookup (.elc, .elp), readlocs units, exclude parsing; Qt test that every chanedit button is enabled; MATLAB parity on jamming for lookup/readlocs/pop_reref exclude.
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, HDF5eeglab_data_hdf5.setwhere 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-05/and ready forgh issue edit --attach. Embedding via--attachfailed with the current fine-grainedGH_TOKEN(HTTP 403 onuploads.github.com). Runattach_screenshots.shwith 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).
- [ ] F12 — low — Tools > Re-reference
Finding (full audit text): The dialog header reads "Current data reference state is: []" in eegprep vs "...: unknown" in EEGLAB (a Python repr of an empty ref leaks through). It also disagrees with eegprep's own main window ("common"). Fields, defaults and layout otherwise match. Numerics with default avg ref match: ch1 samples 1-5 = [-21.751802 -22.726681 -21.139109 -24.434748 -24.105255] in both. EEGLAB com: EEG = pop_reref( EEG, []);. After OK, eegprep shows the pop_newset dialog and stores dataset #2 with Reference=average
Evidence / screenshots: reref_dialog_side_by_side_20261104_230242.png, after_reref_ok_20261104_230307.png, eegprep_after_reref_newset_20261104_230328.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):
reref_dialog_side_by_side_20261104_230242.png— 12: reref_dialog_side_by_side_20261104_230242after_reref_ok_20261104_230307.png— 12: after_reref_ok_20261104_230307eegprep_after_reref_newset_20261104_230328.png— 12: eegprep_after_reref_newset_20261104_230328
- [ ] F36 — high — Edit > Channel locations
Finding (full audit text): All pop_chanedit action buttons are disabled: Read locations, Look up locs, Plot 2-D/3-D, Opt. head center, Rotate, Transform, the 3 conversions, Set head radius/types/reference, Delete/Insert/Append chan, Save .ced/other. So the GUI gives no way to load, look up or plot locations, although the main window hint points users there. There is no automatic lookup prompt either (EEGLAB offers lookup when labels exist but theta is empty). Typing channel 5 and pressing Ok wrote ch1 (FPz) values into ch5 (F4), the same pattern as F35. In EEGLAB every button is enabled and typing 5 + Enter navigates to F4
Evidence / screenshots: F36_eegprep.png, F36_eegprep_dialog.png, F36_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):
F36_eeglab.png— F36: EEGLABF36_eeglab_typed5.png— F36: EEGLABF36_eegprep.png— F36: eegprepF36_eegprep_dialog.png— F36: eegprepF36_eegprep_typed_chan5_20261105_002912.png— F36: eegprep
- [ ] F43 — medium — Channel locations
Finding (full audit text): theta 'abc' is accepted and stored as a string with no message (EEGLAB's function accepts it too, but it is a validation gap)
Evidence / screenshots: F43_eegprep.png, F43_eegprep_dialog.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):
F43_eegprep.png— F43: eegprepF43_eegprep_dialog.png— F43: eegprep
- [ ] F45 — high — Channel locations > Look up locs (scripted)
Finding (full audit text): standard_1005.elc on the BrainVision set: eegprep swaps X and Y (Fp1 X -29.44 / Y 83.92 vs EEGLAB 83.92 / 29.44), so theta is -109.33 vs -19.33 (rotated 90 degrees). standard-10-5-cap385.elp: eegprep matches 0 of 32 channels and wipes the existing coordinates; EEGLAB Fp1 theta -17.926, X 80.784
Evidence / screenshots: F45_evidence.png, eout/ep_lookup_elc.set vs mlout/ml_lookup_elc.set
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):
F45_evidence.png— F45: evidence
- [ ] F46 — high — Channel locations > Read locations (scripted)
Finding (full audit text): Reading eeglab_chan32.locs: eegprep Cartesian coordinates are in unit sphere (ch1 X 0.9998, Z -0.021) while EEGLAB gives head-radius mm (X 84.98, Z -1.786). eegprep also loses the label of ch2 ("EOG1" becomes empty). theta/radius match
Evidence / screenshots: F46_evidence.png, eout/ep_loadlocs.set
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):
F46_evidence.png— F46: evidence
- [ ] F61 — low — Re-reference dialog
Finding (full audit text): Reference state of the raw tutorial set shown as "[]"; EEGLAB shows "unknown".
Evidence / screenshots: F61_eegprep_reref_state_20261105_021250.png, F61_eeglab_reref_state_unknown.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):
F61_eeglab_reref_state_unknown.png— F61: EEGLABF61_eegprep_reref_state_20261105_021250.png— F61: eegprep
- [ ] F62 — high — Tools > Re-reference > Exclude channel indices
Finding (full audit text): Typing "2 6" (1-based, as the field implies and as EEGLAB means) excludes channels 3 and 7 (F3, FC5): history EEG = pop_reref( EEG, [], 'exclude', [3 7]); and data equal pop_reref exclude=[2,6] 0-based. GUI parse is off by one; EEGLAB excludes EOG1/EOG2 as typed.
Evidence / screenshots: F62_eegprep_reref_exclude_typed_20261105_021349.png, F62_eegprep_history_evidence.png, ml_reref_20261105_015609.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):
F62_eegprep_history_evidence.png— F62: eegprepF62_eegprep_reref_exclude_typed_20261105_021349.png— F62: eegprepml_reref_20261105_015609.png— F62: ml_reref_20261105_015609
- [ ] F70 — medium — Python API consistency
Finding (full audit text): pop_interp / pop_reref exclude take 0-based indices, pop_rejchan/rejcont/rejspec/eegthresh take 1-based (0 → "Index out of range"). Easy to get wrong when porting EEGLAB scripts; root of F62.
Evidence / screenshots: logs/compare_tools.txt, progress.log 02:0x
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.
- [ ] Leftover from #544 / F49: pop_chanedit history non-cell form
History like [5 'labels' 'C3x'; ...] cannot be replayed in MATLAB (cellRefFromNonCell). Stream 5 owns pop_chanedit.py and must emit a cell-array form EEGLAB can run. (F49's copyset part stays in Stream 11; writeeeg part in Stream 10.)
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-8ac485f6on 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 Claudereviewcheck). - 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 (navigation helper) and S2 (generic button callback). F45/F46/F62 numerics can start now; wire the F36 buttons after S2 merges. Also fixes the chanedit history form (part of F49).
Shared hotspots (from fix_streams.md):
menu_actions.pyis split by method — only edit this stream's named methods.tests/eeglab_python_backend_xfails.pyandtests/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