Skip to content

[Epic] Integrate EEGLAB parity phases 1-4 - #86

Merged
arnodelorme merged 54 commits into
developfrom
feature/eeglab-completion
May 30, 2026
Merged

arnodelorme merged 54 commits into
developfrom
feature/eeglab-completion

Conversation

@suraj-ranganath

Copy link
Copy Markdown
Member

Integrate completed EEGLAB parity phases 1a, 1b, 2, 3, and 4 from the epic branch into develop. This adds session/data contracts, File/Edit metadata workflows, filtering and cleaning, rejection/component/DIPFIT surfaces, and Plot/time-frequency/statistics workflows with GUI and console coverage.

Part of #60

[Phase 1a] Stabilize EEG session contracts
[Phase 2.1] Implement pop_rmbase baseline parity
[Phase 1b] Add dataset metadata dialogs
[Phase 3] Implement ICLabel component workflows
[Plot] Implement topography plot foundation
Complete Phase 1b File/Edit parity
@claude

claude Bot commented May 29, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @suraj-ranganath's task in 7m 53s —— View job


Code review

  • Overall assessment: Needs changes (a few important fixes + parity verifications).
  • Highest-risk area: rejection helpers (_rejection.py global jointprob mode + duplicate-helper drift) and EEGLAB parity for pop_subcomp / pop_rmbase / pop_editset / pop_eegfiltnew.
  • Merge recommendation: Needs changes before merge.

Blocking

None.

Important

  1. src/eegprep/functions/popfunc/_rejection.py:158, 175 — jointprob_marks and kurtosis_marks compute the per-trial local reject as row_marks[selected, :].any(axis=0) after writing local_reject into row_marks. This round-trip is equivalent to local_reject.any(axis=0) only when elecrange has unique, ordered entries; with duplicates the indexed view does not match local_reject. Replace with reject = local_reject.any(axis=0) | global_reject.ravel() to remove the fragility and one unnecessary copy.

  2. src/eegprep/functions/popfunc/_rejection.py:156-157 and :173-174 — global jointprob/kurtosis builds global_data = data[selected].transpose(2, 0, 1).reshape(trials, -1) so each trial becomes one row of jointprob/rejkurt, which inside _as_rows_points_trials is treated as (rows=trials, points=channels*samples, trials=1). _realproba then forms a per-trial empirical histogram instead of the single across-trial distribution EEGLAB's global mode uses. The local-only branch will look correct, but global thresholds will not match jointprob.m for multi-trial data. Either reshape so the histogram is computed across all trials (e.g. concatenate to a single (1, channels*samples*trials) row, then score each trial against that one distribution) or document the deliberate divergence and add a parity test.

  3. Parallel helpers added in this PR — _is_empty, _is_on, and numeric-vector parsers were introduced (or extended) in ~15 new/touched files: pop_topoplot.py:406,470, pop_headplot.py:687,697, pop_editset.py:450, pop_editeventfield.py:359, pop_editeventvals.py:290, pop_mergeset.py:231, pop_selectevent.py:382, pop_subcomp.py:251, pop_eventstat.py:160, _plot_utils.py:156,252,262, _rejection.py:24, _event_utils.py:116, sigprocfunc/coregister.py:449, sigprocfunc/headplot.py:307,621. Behaviors already diverge (some return list, some ndarray; some treat "0" as empty, some don't). Per AGENTS.md "Agent Failure Patterns to Avoid: Parallel implementations of existing helpers", consolidate into shared helpers in popfunc/_pop_utils.py (already exists in the codebase) before more callers fork.

Nits

  1. src/eegprep/functions/timefreqfunc/newtimef.py:32, 70 — newtimef / compute_time_frequency accept **kwargs and then kwargs.get("winsize"), kwargs.get("freqs"), kwargs.get("nfreqs"), kwargs.get("freqscale"), kwargs.get("timesout"), kwargs.get("padratio"), kwargs.get("overlap"), kwargs.get("baseline"), kwargs.get("scale"), kwargs.get("plot"), kwargs.get("plotersp"), kwargs.get("plotitc"), kwargs.get("title"). AGENTS.md prefers explicit inputs; the silent-kwargs API hides which options are supported and silently ignores typos. Promote to keyword-only parameters and raise on unknown keys (history printing also benefits because you can iterate explicit fields).

  2. src/eegprep/functions/popfunc/_rejection.py:179-203 (trend_marks) — triple-nested Python loop (channels × trials × windows) calling np.polyfit(x, y, 1) per window. For typical EEG sizes this is several orders of magnitude slower than vectorized least-squares. Stack windows into a 2-D matrix and use np.linalg.lstsq or closed-form cov(x,y)/var(x).

  3. src/eegprep/plugins/dipfit/_fieldtrip_workflows.py:19-173 — pop_dipfit_headmodel, pop_dipfit_gridsearch, pop_dipfit_nonlinear, pop_multifit, pop_leadfield open a full dialog and parse options before calling unavailable(...) and raising. The dialog specs and option-conversion helpers (_headmodel_options_from_result, etc.) are unreachable on the success branch and will need to be re-validated when FieldTrip is actually ported. If the intent is "let the menu render the dialog so users see what's coming," confirm that's deliberate and consider a comment marker; otherwise drop the dialog scaffolding and have these entry points raise unavailable() straight away.

Test gaps

  • _rejection.py global mode — tests/test_rejection_workflows.py doesn't appear to assert global-mode thresholds against an EEGLAB or MATLAB-derived reference; given finding Refactor #2, add a parity test (synthetic data with two trials of known distribution) where local-mode and global-mode rejection produce different results and both match expected values.
  • pop_rmbase continuous boundary path — pop_rmbase.py:206-226 only baseline-corrects samples inside each continuous segment that fall within the baseline window. The new tests cover the simple case; add coverage for a window that partially overlaps a boundary and for a segment with no baseline samples (should leave that segment untouched).
  • pop_subcomp ICA-field side effects — verify EEG.reject / icaact / specicaact / specdata are reset to the same shapes EEGLAB resets to; the current test asserts removal but not equivalence to pop_subcomp.m outputs.

EEGLAB parity notes

The vendored EEGLAB submodule (src/eegprep/eeglab/) is uninitialized on this checkout, so the automated parity sweep couldn't quote MATLAB sources directly. Maintainer should manually verify against the matching .m files:

  • pop_subcomp.py:130-138 — confirm EEG.reject = {}, icaact = [], specicaact = [], specdata = [] matches pop_subcomp.m end-of-function clears (and check whether EEG.stats should also be reset).
  • pop_rmbase.py:201 — EEG.icaact = [] is set unconditionally even for the chanlist-restricted path; verify MATLAB does the same when only a subset of channels are baseline-corrected.
  • pop_editset.py:338-358 — xmin change adjusts event latencies only when trials > 1. Continuous datasets with events may need the same shift in EEGLAB.
  • pop_eegfiltnew.py:56 — usefft=True raises instead of falling back; EEGLAB historically warns and continues. Confirm intended behavior.
  • pop_dipfit_settings.py:205 — default _template_index = 2 (MNI BEM); verify this matches the current EEGLAB dipfit default after recent plugin updates.

Inline comments have been posted for the two _rejection.py findings, the dipfit placeholder, and the duplicate-helpers issue.

  • Load skill instructions
  • Gather PR context and changed files
  • Find relevant CLAUDE.md/AGENTS.md
  • Run parallel review agents
  • Validate candidate issues
  • Post review comment and inline comments
    | Branch: feature/eeglab-completion

@suraj-ranganath

Copy link
Copy Markdown
Member Author

🤖 Detailed epic integration report for PR #86.

This PR integrates the completed pieces of the EEGLAB parity epic from feature/eeglab-completion into develop. It includes phases 1a, 1b, 2, 3, and 4. Phases 5 and 6 remain tracked separately under the broader epic plan.

Issues and phase PRs

Epic: #60, Complete EEGPrep core EEGLAB parity except browser and external plugins.

Phase 1a, issue #61: EEG/session/data contract foundation.
Merged PR: #68.

Phase 1b, issue #67: File, dataset, event, and channel metadata parity.
Merged PRs: #71 and #74.

Phase 2, issue #62: Signal conditioning, filtering, baseline, and cleaning.
Merged PRs: #70 and #73.

Phase 3, issue #63: ICA, component, rejection, ICLabel, and DIPFIT workflows.
Merged PRs: #69, #76, and #84.

Phase 4, issue #64: Plotting, topographies, time-frequency, and statistics.
Merged PRs: #72, #75, #77, and #85.

Final integration fixes added on the epic branch

After reviewing the combined branch against origin/develop, two cross-phase integration issues were fixed directly on feature/eeglab-completion:

  1. Component map plotting now respects EEG.icachansind when ICA was run on a channel subset. pop_topoplot, pop_prop, and pop_signalstat now use matching ICA map rows and channel locations through the shared component-map helper. This prevents crashes and wrong channel-location mapping for common workflows where ICA is run after channel selection or channel removal.

  2. Generic Qt dialog import startup was tightened. The manual headplot coregistration editor is now imported only when the Manual coregistration callback runs, so ordinary inputgui dialogs do not eagerly import the Matplotlib 3D/coregistration stack.

Focused verification for this final fix:

EEGPREP_SKIP_MATLAB=1 UV_CACHE_DIR=/private/tmp/uv-cache MPLCONFIGDIR=/private/tmp/mpl-cache uv run --no-sync pytest tests/test_phase4_plot_wrappers.py
35 passed, 4 skipped

UV_CACHE_DIR=/private/tmp/uv-cache MPLCONFIGDIR=/private/tmp/mpl-cache uv run --no-sync ruff check <touched files>
All checks passed

UV_CACHE_DIR=/private/tmp/uv-cache MPLCONFIGDIR=/private/tmp/mpl-cache uv run --no-sync ruff format --check <touched files>
5 files already formatted

UV_CACHE_DIR=/private/tmp/uv-cache MPLCONFIGDIR=/private/tmp/mpl-cache uv run --no-sync ty check
All checks passed

UV_CACHE_DIR=/private/tmp/uv-cache MPLCONFIGDIR=/private/tmp/mpl-cache ./pre-commit.py --fix
OK on 5 staged files

A direct MATLAB-enabled run of tests/test_phase4_plot_wrappers.py was also attempted, but four pre-existing MATLAB Engine parity tests failed with matlab.engine.EngineError: Transport stopped. The Python path relevant to the integration fix passed with MATLAB disabled, as requested for focused testing only.

Features integrated by phase

Phase 1a: data/session contracts

Adds the shared contract foundation for the rest of the epic. EEGPrepSession now has explicit 1-based EEGLAB-facing dataset selection semantics, console projection rules for CURRENTSET, multi-dataset read access, session/history invariants, and machine-readable menu placeholder metadata. Development docs and AGENTS guidance now describe EEG dict field expectations, indexing boundaries, history behavior, and the rule that runtime code must not depend on the vendored EEGLAB checkout.

Phase 1b: File/Edit/Datasets workflows

Adds dataset comments and dataset metadata editing through pop_comments and pop_editset; channel metadata editing through pop_chanedit; dataset copy and merge workflows through pop_copyset and pop_mergeset; event editing through pop_editeventfield and pop_editeventvals; event-based data selection through pop_selectevent; event-window removal through pop_rmdat; a BrainVision/MAT bridge through pop_fileio_brainvision_mat; and user-facing multi-dataset selection through select_multiple_datasets. These actions are wired into the File, Edit, and Datasets menus, packaged help, replayable console history, public lazy exports, sample-data tests, and GUI visual parity cases.

Phase 2: baseline, filtering, FIR, and cleaning-support workflows

Adds native rmbase and EEGLAB-style pop_rmbase baseline removal with continuous/epoched behavior, channel and point/time selection, boundary-event handling, GUI/menu dispatch, help, and MATLAB parity coverage. Adds legacy pop_eegfilt, modern pop_eegfiltnew, and bundled firfilt plugin workflows pop_firws, pop_firpm, and pop_firma, including FIR design helpers, boundary-aware filtering, epoched filtering, ICA activation invalidation, valid history replay, GUI dialogs, and visual parity captures.

Phase 3: ICLabel, component removal, rejection, and DIPFIT surfaces

Adds pop_icflag and pop_subcomp with ICLabel thresholding, component-removal behavior, menu dispatch, GUI specs, help resources, sample-data tests, and console history support. Adds rejection workflows including eeg_rejsuperpose, pop_eegthresh, pop_jointprob, pop_rejkurt, pop_rejtrend, pop_rejspec, pop_rejchan, pop_rejcont, pop_autorej, pop_rejepoch, pop_rejmenu, pop_selectcomps, and pop_viewprops, while keeping EEGPlot/EEGBrowser scrolling behavior explicitly excluded. Adds bundled DIPFIT menu surfaces: real standalone settings storage via pop_dipfit_settings, standalone dipole plotting via pop_dipplot, and clear DIPFITUnavailableError paths for FieldTrip-dependent headmodel/gridsearch/nonlinear/multifit/leadfield/LORETA workflows.

Phase 4: Plot, topography, headplot, time-frequency, and statistics workflows

Adds topography and plotting foundations: pop_topoplot, channel-location blank topoplots, pop_spectopo, pop_prop, pop_timtopo, pop_plottopo, pop_plotdata, pop_erpimage, pop_envtopo, pop_comperp, and pop_chanplot. Adds 3D headplot spline setup/rendering, packaged headplot resources, pop_headplot, reusable .spl setup/load history, and the manual coregistration editor. Adds time-frequency/statistics workflows: newtimef, newcrossf, pop_newtimef, pop_newcrossf, signalstat, pop_signalstat, and pop_eventstat, with unsupported EEGLAB bootstrap/curve paths failing clearly rather than silently changing behavior. Plot menu actions are wired through GUI, console, help, visual parity, and sample-data/headless tests.

Integration status

Before the final small fix commit, the combined epic branch passed the broad integration checks run locally:

ruff check: passed
ruff format --check: passed
ty check: passed
focused cross-phase integration suite: 416 passed
EEGPREP_SKIP_MATLAB=1 pytest -m "not slow": 1351 passed, 201 skipped, 11 deselected
MATLAB-enabled phase parity smoke: 124 passed, 2 skipped
pre-commit --changed-from origin/develop: passed

The final commit was intentionally validated with focused checks only, per request.

@suraj-ranganath

Copy link
Copy Markdown
Member Author

🤖 GUI visual parity evidence for PR #86.

These images are GitHub user attachments and are not committed to the repository. They were collected from the merged phase PRs, with older local/blob-only artifacts re-uploaded through gh image so this PR has attachment-backed references.

Phase 1b: File, Edit, Datasets, metadata, event, and channel dialogs

Dataset comments
pop_comments side-by-side

Dataset metadata
pop_editset side-by-side

File menu
File menu side-by-side

Edit menu
Edit menu side-by-side

Datasets menu
Datasets menu side-by-side

Channel editing
pop_chanedit side-by-side

Copy dataset
pop_copyset side-by-side

Edit event fields
pop_editeventfield side-by-side

Edit event values
pop_editeventvals side-by-side

Merge datasets
pop_mergeset side-by-side

Remove event windows
pop_rmdat side-by-side

Select events
pop_selectevent side-by-side

Select multiple datasets
select_multiple_datasets side-by-side

Phase 2: baseline and FIR/filter dialogs

Remove baseline
pop_rmbase side-by-side

Legacy filter
pop_eegfilt side-by-side

Modern FIR filter
pop_eegfiltnew side-by-side

Windowed-sinc FIR
pop_firws side-by-side

Parks-McClellan FIR
pop_firpm side-by-side

Moving-average FIR
pop_firma side-by-side

Phase 3: ICLabel, component, rejection, and DIPFIT dialogs

ICLabel flagging
pop_icflag side-by-side

Remove components
pop_subcomp side-by-side

Auto reject
pop_autorej side-by-side

Threshold rejection
pop_eegthresh side-by-side

Joint probability rejection
pop_jointprob side-by-side

Channel rejection
pop_rejchan side-by-side

Continuous rejection
pop_rejcont side-by-side

Kurtosis rejection
pop_rejkurt side-by-side

Reject menu
pop_rejmenu side-by-side

Spectral rejection
pop_rejspec side-by-side

Trend rejection
pop_rejtrend side-by-side

Select components
pop_selectcomps side-by-side

View properties
pop_viewprops side-by-side

DIPFIT settings
pop_dipfit_settings side-by-side

DIPFIT gridsearch
pop_dipfit_gridsearch side-by-side

DIPFIT nonlinear fit
pop_dipfit_nonlinear side-by-side

DIPFIT dipole plot
pop_dipplot side-by-side

DIPFIT multifit
pop_multifit side-by-side

DIPFIT leadfield
pop_leadfield side-by-side

DIPFIT LORETA
pop_dipfit_loreta side-by-side

DIPFIT headmodel EEGPrep capture
pop_dipfit_headmodel EEGPrep

Phase 4: topography, plotting, headplot, time-frequency, and statistics dialogs

ERP scalp maps
pop_topoplot ERP side-by-side

Component scalp maps
pop_topoplot components side-by-side

Spectopo channels
pop_spectopo channels side-by-side

Spectopo components
pop_spectopo components side-by-side

Properties channels
pop_prop channels side-by-side

Properties components
pop_prop components side-by-side

Timtopo
pop_timtopo side-by-side

Plottopo
pop_plottopo side-by-side

Plot data
pop_plotdata side-by-side

ERP image channels
pop_erpimage channels side-by-side

ERP image components
pop_erpimage components side-by-side

Envtopo
pop_envtopo side-by-side

Compare ERPs channels
pop_comperp channels side-by-side

Compare ERPs components
pop_comperp components side-by-side

Headplot ERP setup
headplot ERP dialog

Headplot component setup
headplot components dialog

Headplot ERP 3D plot
headplot ERP 3D plot

Headplot component 3D plot
headplot component 3D plot

Manual coregistration
coregister side-by-side

Newtimef channels
pop_newtimef channels side-by-side

Newtimef components
pop_newtimef components side-by-side

Newcrossf channels
pop_newcrossf channels side-by-side

Newcrossf components
pop_newcrossf components side-by-side

Signal statistics channels
pop_signalstat channels side-by-side

Signal statistics components
pop_signalstat components side-by-side

Event statistics
pop_eventstat side-by-side

@suraj-ranganath

Copy link
Copy Markdown
Member Author

🤖 Visual parity refresh after commit 5409c02.

I re-ran current macOS visual captures and tightened the main remaining mismatches:

  • shared Qt dialog spacing now respects spacer rows and uses fixed natural-width buttons instead of stretching every pushbutton;
  • pop_headplot dialog now uses the EEGLAB-sized footprint and matching margins;
  • DIPFIT settings uses the wider EEGLAB-style layout;
  • rejection-menu action buttons now match EEGLAB widths while color swatches remain compact;
  • ERP/component 3-D headplots now use a larger EEGLAB-like canvas, a single title, closer camera scale, fallback skin coloring, and EEGLAB-style multi-light shading.

Focused verification: ruff check, ruff format --check, ty check, tests/test_phase4_plot_wrappers.py -k 'headplot and not matlab', tests/test_visual_parity.py, tests/test_gui_rejection_dialogs.py, tests/test_gui_pop_clean_rawdata.py, tests/test_gui_pop_adjustevents.py, and relevant dialog validation tests.

adjust-events-dialog.png select-data-dialog.png
adjust-events-dialog.png select-data-dialog.png
clean-rawdata-dialog.png dipfit-settings-dialog.png
clean-rawdata-dialog.png dipfit-settings-dialog.png
rejection-menu-dialog.png headplot-dialog.png
rejection-menu-dialog.png headplot-dialog.png
headplot-erp-3d-plot.png headplot-component-3d-plot.png
headplot-erp-3d-plot.png headplot-component-3d-plot.png

@suraj-ranganath

Copy link
Copy Markdown
Member Author

@claude review this

@claude

claude Bot commented May 29, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @suraj-ranganath's task in 7m 37s —— View job


Code review

  • Overall assessment: Approve with minor follow-up nits — prior-review blocking items are substantively addressed in commits 8aeff57, 22620d3, and 5409c02.
  • Highest-risk area: continuous pop_rmbase semantics (deliberate divergence from EEGLAB; tests pin the Python behavior).
  • Merge recommendation: Ready to merge.

Verification of prior-review items

  1. ✅ _rejection.py round-trip via row_marks (lines 131, 150) — now reads directly from local_reject: reject = local_reject.any(axis=0) | global_reject.ravel().

  2. ✅ Global jointprob/kurtosis "per-trial vs. across-trial histogram" — I re-checked against the freshly-initialized EEGLAB submodule. pop_jointprob.m:205-207 reshapes to (trials, channels*pnts) exactly like the Python code does (data[selected].transpose(2, 0, 1).reshape(data.shape[2], -1)). Inside jointprob.m:88-106, MATLAB iterates for rc=1:nbchan and builds a per-row probability distribution, then normalizes across all rows when ndims(signal)==2 (line 119: jp = (jp-mean(tmpjp)) / std(tmpjp)). That's exactly what _normalize_scores does for signal_ndim == 2. The Python port already matched EEGLAB; the prior-review concern was based on a misreading of jointprob.m. The new parity tests (test_jointprob_global_marks_match_eeglab_trial_rows_for_duplicate_channels, test_jointprob_global_threshold_can_reject_when_local_threshold_does_not, and the kurtosis equivalents) are good defensive coverage.

  3. ✅ Parallel _is_on / _is_empty / _parse_numeric_sequence helpers — _pop_utils.py now owns parse_numeric_sequence, is_empty_value, is_on, format_history_value, and parse_text_tokens. Remaining local definitions (e.g. pop_topoplot._parse_numeric_sequence:375, sigprocfunc/headplot._parse_numeric_sequence:315) are thin shims that just adjust return types (ndarray vs. list) and delegate to the shared helper.

  4. ✅ newtimef **kwargs — replaced by explicit keyword-only parameters (winsize, freqs, nfreqs, freqscale, timesout, padratio, overlap, baseline, scale, plot, plotersp, plotitc, title). compute_time_frequency is also explicit.

  5. ✅ trend_marks triple-nested loop — collapsed to one Python loop over channels with np.tensordot-based vectorized slope/SST/SSE per channel; no per-window np.polyfit calls remain.

  6. ✅ _fieldtrip_workflows.py dialog scaffolding — kept intentionally with a clear top-of-file comment (lines 18-21) explaining the "validate inputs, render dialog so the menu surfaces the workflow, then unavailable()" pattern.

  7. ✅ EEGLAB parity checks:

    • pop_eegfiltnew usefft=True raises — matches pop_eegfiltnew.m:187-189 which also error()s.
    • pop_editset xmin event shift — the Python code (pop_editset.py:79-80) calls _adjust_event_latencies_for_xmin_change unconditionally when xmin is in options, matching pop_editset.m:328-343 which also doesn't gate on trials > 1.
    • pop_subcomp field clears — matches pop_subcomp.m:210-216: icaact=[], specicaact=[], specdata=[], reject={}, stats deliberately preserved. New test test_component_removal_preserves_stats_like_eeglab pins this.

Remaining nits (non-blocking)

  1. pop_rmbase.py:206-226 continuous boundary path is a deliberate improvement over MATLAB, but the comment hides this. MATLAB's pop_rmbase.m:183-198 builds boundary indices relative to pointrange(1) and then uses them as absolute EEG.data(chanlist, tmprange) indices — so when pointrange(1) > 1, MATLAB silently writes to the wrong data slice (e.g. pointrange=21:40 with a boundary at sample 30.5 writes to data samples 1-10 and 11-20, not 20-29 and 30-39). The Python implementation writes to the actual baseline samples within each true segment, which is semantically correct. The inline comment # EEGLAB's boundary path only writes the selected baseline window. undersells this — consider noting "Python intentionally diverges from pop_rmbase.m, which uses pointrange-relative indices as absolute data indices (likely a MATLAB bug)." A MATLAB-parity test would otherwise fail in subtle ways for offset pointranges.

  2. newtimef._is_on (line 487) silently shadows _pop_utils.is_on with opposite-default semantics. Local: True unless value is in {"0", "false", "off", "no", "none"} (defaults to True for unknown). Shared is_on: True only when value is in {"1", "on", "true", "yes"} (defaults to False). newcrossf._is_on:132 does the same. This is fine for matching EEGLAB's "default on" convention in time-frequency, but worth either (a) hoisting to _pop_utils as is_off_value() so the inverted default is named, or (b) adding a one-line comment explaining the inversion.

  3. pop_rmbase.py:201 clears EEG.icaact unconditionally even for the chanlist-restricted path. I checked pop_rmbase.m:209 and MATLAB also does EEG.icaact = [] unconditionally at the end of the function, so the Python matches. (Just confirming a prior-review parity flag — no change needed.)

  4. pop_subcomp.py:138 trims EEG.dipfit.model via _trim_dipfit_model but no test exercises the dipfit-present branch. Worth a small unit test feeding EEG["dipfit"] = {"model": [..., ..., ...]} and asserting it shrinks alongside icawinv columns.

  5. Pre-existing parallel _is_on / _is_empty definitions in pop_runica.py, pop_export.py, pop_epoch.py, pop_reref.py were not folded into _pop_utils. Out of scope for this PR (they predate develop), but the consolidation pass should continue when those files are next touched.

Test status

Ran focused suite locally:

uv run --no-sync pytest tests/test_rejection_workflows.py \
                        tests/test_pop_rmbase.py \
                        tests/test_gui_pop_subcomp.py \
                        tests/test_pop_editset.py \
                        tests/test_pop_utils.py
65 passed, 6 skipped (MATLAB unavailable)

The 6 skips are the EEGLAB-parity tests that require MATLAB Engine — preserved skip behavior matches AGENTS.md guidance.

Summary

The blocking concerns from the prior review (_rejection.py round-trip, helper consolidation, newtimef kwargs, trend_marks perf, dipfit dialog comment) are addressed with both code changes and tightened tests. The previously-flagged "global mode is wrong" was actually a misreading of EEGLAB's MATLAB; the Python port is faithful, and the new parity tests pin that. Outstanding items are minor (a couple of comments to clarify intent, one small dipfit-trim test).

  • Sync local checkout
  • Inspect commits since prior review (8aeff57, 22620d3, 5409c02)
  • Verify prior-review fixes
  • Verify EEGLAB parity against fresh submodule (jointprob.m, pop_eegfiltnew.m, pop_editset.m, pop_subcomp.m, pop_rmbase.m)
  • Run focused test subset
    | Branch: feature/eeglab-completion

@arnodelorme
arnodelorme merged commit 2985e43 into develop May 30, 2026
9 checks passed
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.

2 participants