Skip to content

[Release readiness] Stream 6: Rejection numbers #551

Closed

Description

@suraj-ranganath

[Release readiness] Stream 6: Rejection numbers

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: Artifact rejection numerics and marks (size L). Findings assigned: F66, F67, F68, F84, F86, F98, F104, F107, F110, F111, F112.

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

popfunc/pop_rejcont.py, pop_rejchan.py, pop_autorej.py, pop_rejspec.py (+ spectral helper), eeg_rejsuperpose.py, pop_rejepoch.py, pop_eegthresh.py; menu_actions.py: _run_rejsuperpose (1462-1472)

Dependencies / merge order: Independent of the GUI streams. pop_rejmenu.py belongs to S2; S2's buttons call these functions, so run an integration check after both merge.

Suggested tests from the stream plan: Function tests plus MATLAB parity on jamming with identical parameters (rejcont, rejchan, rejspec multitaper/FFT, autorej, superpose/export/reject marked).

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

- [ ] F66 — high — pop_rejcont (versL, scripted)

Finding (full audit text): Same parameters (elec 1..32, freqlimit [20 40], threshold 10, epoch 0.5, contiguous 4, addlength 0.25, hamming) on the 1 Hz HP data: eegprep removes the entire recording (pnts 0, xmax -0.0078); EEGLAB removes 9 regions (28008 pnts left).

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

  • F66_eegprep_vs_eeglab_rejcont.png — F66: F66_eegprep_vs_eeglab_rejcont

- [ ] F67 — high — pop_rejchan (versL, scripted, 1-based in both)

Finding (full audit text): kurtosis thr 5 norm on: eegprep removes [1] (31 ch) vs EEGLAB [1 2 6] (29 ch); probability: eegprep removes none vs EEGLAB [1 2].

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

  • F67_eegprep_vs_eeglab_rejchan.png — F67: F67_eegprep_vs_eeglab_rejchan

- [ ] F68 — medium — pop_rejspec / pop_autorej (scripted)

Finding (full audit text): rejspec (thr [-35 35], 15–30 Hz): eegprep marks 0 epochs vs EEGLAB 37. autorej defaults: eegprep keeps 74 trials vs EEGLAB 75 (extra epoch 16). eegthresh, jointprob, rejkurt, rejtrend, rejepoch exact.

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

  • F68_eegprep_vs_eeglab_rejspec_autorej.png — F68: F68_eegprep_vs_eeglab_rejspec_autorej

- [ ] F84 — high — Tools > Automatic continuous rejection (pop_rejcont, all menus)

Finding (full audit text): On continuous eeglab_data with defaults, eegprep marks the WHOLE dataset (winrej 1..30504) and opens eegplot at spacing 1.0, so the traces overlap. Headless eegprep pop_rejcont also leaves 0 points. EEGLAB marks 9 regions (e.g. 321-480, 3489-3936, 4289-4608, 7713-7904, 13505-13664, 26561-26816, ...), keeps 28008 points, and opens eegplot at scale 80. eegprep adds a Help button that EEGLAB's dialog doesn't have.

Evidence / screenshots: F84_rejcont_sbs.png, P_A_rejcont_dlg_sbs.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_A_rejcont_dlg_sbs.png — F84: EEGLAB vs eegprep side-by-side
  • F84_rejcont_sbs.png — F84: EEGLAB vs eegprep side-by-side

- [ ] F86 — medium — Tools > Automatic channel rejection (pop_rejchan, all menus)

Finding (full audit text): With kurtosis, electrodes 1:32, z threshold 5 and normalization on, EEGLAB rejects channels [1 2] (both on fresh data and after autorej, giving nbchan 30). eegprep rejects only [1], headless and in the GUI (31 channels left).

Evidence / screenshots: F86_rejchan_sbs.png, P_A_rejchan_dlg_sbs.png, mlout/dh_num.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):

  • P_A_rejchan_dlg_sbs.png — F86: EEGLAB vs eegprep side-by-side
  • F86_rejchan_sbs.png — F86: EEGLAB vs eegprep side-by-side

- [ ] F98 — low — Automatic channel rejection dialog/history

Finding (full audit text): eegprep adds a "Standard deviation" measure and leaves the spectrum frequency range enabled for non-spectrum measures (EEGLAB disables it). History quotes numbers; EEGLAB uses vararg2str (EEG = pop_rejchan(EEG, 'elec',[1:32] ,'threshold',5,'norm','on','measure','kurt');).

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

  • F98_rejchan_dlg_sbs.png — F98: EEGLAB vs eegprep side-by-side

- [ ] F104 — medium — Reject data epochs > Export marks to ICA reject

Finding (full audit text): eeg_rejsuperpose has typerej inverted (0 vs EEGLAB 1), and the icarejmanual = rejglobal copy is missing, so icarejmanual stays empty. EEGLAB gives icarejmanual = 71 after thresh 75.

Evidence / screenshots: P_F104exp2ica_dlg_eegprep_20261105_050022.png, F104exp2ica_eegprep_20261105_050025.png, P_F104thresh_dlg_eegprep_20261105_045952.png, F104thresh_res_eegprep_20261105_050010.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_F104exp2ica_dlg_eegprep_20261105_050022.png — F104: eegprep
  • P_F104thresh_dlg_eegprep_20261105_045952.png — F104: eegprep
  • F104exp2ica_eegprep_20261105_050025.png — F104: eegprep
  • F104thresh_res_eegprep_20261105_050010.png — F104: eegprep

- [ ] F107 — low — Reject data using ICA > Find abnormal values

Finding (full audit text): The default component range is 1:32; EEGLAB uses 1:5. With equal settings the counts match (thresh 20 gives 80 in both).

Evidence / screenshots: F107_icathresh_sbs.png, P_F107icathresh_dlg_eegprep_20261105_050158.png, P_F107icathresh_eegprep_20261105_050211.png, P_F107icathresh_dlg_eeglab_20261105_052541.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):

  • F107_icathresh_sbs.png — F107: EEGLAB vs eegprep side-by-side
  • P_F107icathresh_dlg_eeglab_20261105_052541.png — F107: EEGLAB
  • P_F107icathresh_dlg_eegprep_20261105_050128.png — F107: eegprep
  • P_F107icathresh_dlg_eegprep_20261105_050158.png — F107: eegprep
  • P_F107icathresh_eegprep_20261105_050211.png — F107: eegprep

- [ ] F110 — high (numeric) — Reject by spectra, data and ICA (pop_rejspec)

Finding (full audit text): FFT method matches: data 44 = 44, ICA 46 = 46 with the same indices. Multitaper diverges: eegprep marks 0 epochs for both data and ICA; EEGLAB marks 37 (data) and [13 14 15 26 79] (ICA, ±30 dB, 15–30 Hz). Points to a scaling bug in the multitaper spectrum.

Evidence / screenshots: F110_icarejspec_sbs.png, P_F110icaspec_dlg_eegprep_20261105_050249.png, P_F110icaspec_eegprep_20261105_050302.png, P_F110icarejspec_dlg_eeglab_20261105_052552.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):

  • F110_icarejspec_sbs.png — F110: EEGLAB vs eegprep side-by-side
  • P_F110icarejspec_dlg_eeglab_20261105_052552.png — F110: EEGLAB
  • P_F110icaspec_dlg_eegprep_20261105_050144.png — F110: eegprep
  • P_F110icaspec_dlg_eegprep_20261105_050249.png — F110: eegprep
  • P_F110icaspec_eegprep_20261105_050302.png — F110: eegprep

- [ ] F111 — medium — Reject data using ICA > Export marks to data reject

Finding (full audit text): rejglobal is set to 80 but rejmanual isn't. EEGLAB sets rejmanual = [9 10 16 53 69].

Evidence / screenshots: P_F111ica2data_dlg_eegprep_20261105_050317.png, F111ica2data_eegprep_20261105_050320.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_F111ica2data_dlg_eegprep_20261105_050317.png — F111: eegprep
  • F111ica2data_eegprep_20261105_050320.png — F111: eegprep

- [ ] F112 — high — Reject data epochs / ICA > Reject marked epochs

Finding (full audit text): Uses a stale rejglobal without superposing, so pop_rejepoch(EEG,[],1) does nothing. When every epoch is marked it throws a 'dataset is empty' traceback instead of an error dialog.

Evidence / screenshots: P_F112icarejep_dlg_eegprep_20261105_050324.png, F112icarejep_dlg2_eegprep_20261105_050325.png, P_F112icarejep_dlg_eegprep_20261105_050339.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_F112icarejep_dlg_eegprep_20261105_050324.png — F112: eegprep
  • P_F112icarejep_dlg_eegprep_20261105_050339.png — F112: eegprep
  • F112icarejep_dlg2_eegprep_20261105_050325.png — F112: eegprep

- [ ] F108 — info (pass) — Reject data using ICA > Find abnormal trends (no eegprep code fix expected)

Audit note: Marks all 80 at the defaults, same as EEGLAB (80).

Disposition: Pass (trend marks equal)

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: P_F108icatrend_dlg_eegprep_20261105_050215.png, P_F108icatrend_eegprep_20261105_050228.png

Screenshots (filenames; attach pending):

  • P_F108icatrend_dlg_eegprep_20261105_050133.png — F108: eegprep

- [ ] F109 — info (pass) — Reject data using ICA > Find improbable / abnormal distributions (kurtosis) (no eegprep code fix expected)

Audit note: Marks [9 10 16 53 69] in both.

Disposition: Pass (kurtosis marks equal)

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: P_F109icakurt_dlg_eegprep_20261105_050232.png, P_F109icakurt_eegprep_20261105_050245.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

Independent of the GUI streams. pop_rejmenu.py belongs to S2; S2's buttons call these functions, so run an integration check after both merge.

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

Screenshots (filenames; attach pending):

  • P_F109icakurt_dlg_eegprep_20261105_050139.png — F109: eegprep

Activity

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

    @suraj-ranganath
    MemberAuthor

    Closing. Stream 6 landed in develop as squash c7247234 via #559. That PR said Refs #551 rather than Fixes #551, so GitHub didn't close this automatically.

    What's fixed:

    • F66, F67, F68, F84, F86, F98, F104, F107, F110, F111 and F112.
    • F108 and F109 were re-verified.

    This is covered by tests/test_stream6_rejection_numbers.py. MATLAB was checked on 3b5685cf against EEGLAB d0963be9, and the GUI was rechecked by hand on the PR.

    Three deliberate differences from EEGLAB are kept:

    • multitaper output uses 10*log10, where EEGLAB uses 10*log;
    • pop_rejcont uses the real FFT bins, where EEGLAB uses linspace;
    • channel-mode autorej reads rejkurt, which keeps epoch 16.

    One optional follow-up: #570, a half-count tie test for the 2-D trim.

  3. arnodelorme commented on Dec 1, 2026

    @arnodelorme
    Collaborator

    🤖 The pop_rejcont dialog and native jamming captures are tracked in #934.

  4. arnodelorme commented on Dec 1, 2026

    @arnodelorme
    Collaborator

    🤖 The pop_rejmenu dialog and native jamming captures are tracked in #1009.

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