Skip to content

Stream 2: Dialogs and Edit selection (F37, F39, F40, F44, F48, F50, F100, F101, F102, F105, F124) - #566

Merged
suraj-ranganath merged 15 commits into
developfrom
stream2-dialogs
Nov 7, 2026
Merged

suraj-ranganath merged 15 commits into
developfrom
stream2-dialogs

Conversation

@suraj-ranganath

@suraj-ranganath suraj-ranganath commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Fixes #548 (Stream 2 findings).

Summary

Release-readiness GUI audit Stream 2: dialog plumbing and Edit selection dialogs (F37, F39, F102/F105, F100, F101, F124, F48, F40, F44, F50).

Per-finding

Finding Change
F37 Select data: empty channel types no longer crash; type picker disabled when absent
F39 Select epochs/events: MATLAB array event descriptions normalized to readable text
F102 / F105 Data and ICA rejection menus: buttons enabled and wired; dialog fits 1073×994; Calc/Scroll/PLOT/Help work. PLOT calculates marks and opens the scrolling rejection browser (stream plan / available parity). EEGLAB PLOT opens interactive rejstatepoch, which is not ported — documented
F100 Event fields: readable/editable descriptions and working file pickers
F101 firpm Estimate opens the filter-order sub-dialog
F124 Extract epochs event-type picker supports multiple selections
F48 About this dataset: comment line breaks preserved in Qt
F40 Select events matching nothing: helpful warning (EEGLAB can stay silent)
F44 Epoch time crop: event retention fixed (8 events). Inclusive endpoints kept (129 points / xmax=0.5) vs EEGLAB 8ac485f6 (128 / 0.4921875). Verified on jamming: pop_select.m → epoch() upper-exclusive; epoch.m documents the off-by-one while pop_select help says inclusive. Documented and tested
F50 Selection preserves input precision; numeric/string event matching and numeric history. Embedded-save float32 policy left to S1

Scrutiny notes (pre-merge)

  • F44: Re-ran pinned EEGLAB on jamming; confirmed 128 pnts / 8 events. Kept inclusive 129 as the documented-correct behavior.
  • F102 PLOT: An earlier draft shipped compact matplotlib statistics plots with a false "approved" claim. That path was removed. PLOT now calculates and opens the scroll rejection browser; docs state that rejstatepoch remains unported.

Out of scope / known gaps in this area

  • Console history still emits MATLAB ranges such as [1:32] that are invalid in Python (Stream 11 / console.py).
  • rejstatepoch remains unported; PLOT uses the scroll browser instead.
  • Embedded .set save precision (F50 remainder) assigned to S1.

Test plan

  • Offscreen Qt tests for rejmenu / eventfield / selection dialogs
  • pop_select / pop_selectevent regression tests including F44 inclusive crop
  • Side-by-side GUI retest vs EEGLAB (gui-parity)
  • MATLAB parity probes on jamming where applicable
  • CI green + Claude review addressed before merge ask

Do not merge without Suraj's explicit approval.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Code review skipped — your organization has no extra usage available to pay for this review.

If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.

Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.

@claude

claude Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @suraj-ranganath's task in 18s —— View job


PR review skipped: PR is a draft

  • Pre-review gate
  • Gather context and diff (skipped)
  • Review passes (skipped)
  • Validate findings and post review (skipped)

I didn't review this PR because it is still a draft. The repo's github-pr-review workflow skips draft PRs. Nothing was posted and no code was changed.

Checked:

  • The PR head (9bb02ae) matches the checked-out commit.
  • There is no earlier eegprep-claude-review comment.

To get a review, mark the PR "Ready for review" and trigger @claude again.

@suraj-ranganath
suraj-ranganath marked this pull request as draft November 7, 2026 01:51
@suraj-ranganath
suraj-ranganath marked this pull request as ready for review November 7, 2026 01:52
@claude

claude Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @suraj-ranganath's task in 2m 41s —— View job


Code review

  • Overall assessment: Needs changes before merge. One process requirement is missing; I found no code defects. I checked:
    • the pop_select epoch time crop (xmin/xmax, per-epoch event latencies before and after trial selection, icaact cropping)
    • pop_selectevent numeric type criteria and the empty-selection warning
    • pop_editeventfield description alignment with urevent, moving *info handling ahead of the empty-value delete, and file-path values
    • pop_rejmenu Calc/Plot/Scroll/HELP/color wiring, Cancel isolation via copy_eeg, and command accumulation
    • the pop_firpmord GUI path and its cancel handling
    • the Qt textarea, pushbutton value, and edit_text first-line label changes
  • Highest-risk area: the epoched time crop in pop_select (src/eegprep/functions/popfunc/pop_select.py:394-415). It changes xmax and event latencies.
  • Merge recommendation: Needs changes. Add the EEGLAB MATLAB reference-suite evidence (see Important).

Blocking

None.

Important

  • The MATLAB reference-suite evidence is missing from the PR description. This PR changes EEGLAB-ported processing code:

    • pop_select epoch crop: EEG.xmax, event latency and retention, icaact
    • pop_selectevent: numeric criteria
    • pop_editeventfield._apply_options: *info is now applied before the empty-value delete

    AGENTS.md §Testing says: "Before merging a PR that changes core function implementations … trigger .github/workflows/eeglab-reference.yml … on the PR branch, or run the suite locally once on the final branch" and "Put that run in the PR description: the exact command or workflow run, the EEGLAB and eeglab_tests commits, pass/fail/skip counts, runtime, and an explanation for any failures or skips." The description only reports a focused run ("290 passed, 5 MATLAB skips").
    Fix: dispatch eeglab-reference.yml on stream2-dialogs, or run uv run --no-sync pytest tests --eeglab-backend=matlab --eeglab-root=<pinned> --eeglab-suite-root=<pinned>. Paste the result into the PR body. This matters most for the F44 crop: the existing @eeglab_test pop_select cases should show whether the new xmax = xmin + (b-1)/srate agrees with EEGLAB everywhere outside the documented 128 vs 129 endpoint difference.

Nits

None.

Test gaps

None. The new tests cover each changed behavior:

  • F44: inclusive endpoints, event retention with and without trial selection, cached icaact
  • F50: dtype is preserved
  • rejmenu: Calc, Plot, and Scroll per method, both data and ICA, plus the button-wiring and height check
  • firpm Estimate, multi-select epoch types, comments line breaks, event-field descriptions and file picker

EEGLAB parity notes

None beyond the documented differences (F40 warning, F44 inclusive endpoint, F50 precision). Each is listed in eeglab_migration.rst and covered by a test. The inclusive endpoint itself predates this PR; the slice data[:, a-1:b] is unchanged. This PR only corrects xmax and event latencies to match it.

Limitation: the vendored EEGLAB tree (src/eegprep/eeglab/) isn't present in this CI checkout. I could not compare pop_rejmenu.m line by line, for example the pop_rejtrend(..., EEG.pnts, ...) window size or the Scroll button semantics for probability/kurtosis. Those need a manual check against the reference GUI.

@suraj-ranganath
suraj-ranganath marked this pull request as draft November 7, 2026 01:59

@suraj-ranganath suraj-ranganath left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressing Claude's Important item (MATLAB reference-suite evidence):

Ran the focused MATLAB backend suite on jamming against this head (9bb02aef), with AGENTS.md pins EEGLAB d0963be9 and eeglab_tests fec88f9f, via matlab-batch (EEGPREP_MATLAB_BATCH_DIR) under flock ~/matlab.lock:

python -m pytest tests/test_pop_select.py tests/test_phase1b_file_edit_pop_functions.py tests/test_gui_pop_select.py \
  -q --eeglab-backend=matlab --eeglab-root=~/eegprep-bench/eeglab --eeglab-suite-root=~/eegprep-bench/eeglab_tests

Result: 99 passed, 1 skipped in 23.84 s. That covers the F44 xmax/event-latency/icaact crop paths and the pop_selectevent reference cases Claude called out. Full eeglab-reference.yml workflow_dispatch returned 403 from this token, so the focused jamming run is what we used; details are now in the PR description.

No Blocking findings to fix. No code changes from this review. Please re-review when ready.

@suraj-ranganath
suraj-ranganath marked this pull request as ready for review November 7, 2026 01:59
@claude

claude Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @suraj-ranganath's task in 2m 20s —— View job


Code review

  • Pre-review gate: the PR is open and ready, and the head 9bb02ae matches the checkout. Re-review was requested in the author's review comment.

  • Gather context and diff

  • Review passes: AGENTS.md compliance, conventions, correctness, EEGLAB parity

  • Validate findings and post review

  • Overall assessment: Needs changes. One process item remains. I found no code defects. I checked:

    • pop_select epoch crop: xmin/xmax now snap to samples. Per-epoch latencies are computed after the earlier trial renumbering and use the old pnts. icaact is cropped before the trial slice. Retention is inclusive at a/b.
    • _channel_type_text: handles empty arrays, None and plain strings.
    • pop_selectevent: numeric criteria are applied only when every non-boundary event type is numeric. The empty-selection warning works.
    • pop_editeventfield:
      • *info is now applied before the empty-value delete.
      • Descriptions line up with include_urevent field order.
      • File-path values reach the existing _values_from_file loader.
    • pop_rejmenu:
      • The _METHODS options match the pop_eegthresh, pop_rejtrend, pop_jointprob, pop_rejkurt and pop_rejspec signatures, including pop_rejspec defaulting to eegplotreject=0.
      • The stats field names (jpE/icajpE, kurtE/icakurtE) match the producers.
      • copy_eeg keeps Cancel from touching the input EEG.
      • Commands accumulate correctly.
    • pop_firpmord: the GUI path returns early when the sub-dialog is cancelled (order is None).
    • Qt changes: the run_dialog_action, show_help, select_color and edit_text first-line wiring work.
  • Highest-risk area: event latency and xmax recalculation in the pop_select epoch crop (src/eegprep/functions/popfunc/pop_select.py:394-411).

  • Merge recommendation: Needs changes. The MATLAB reference run doesn't yet cover all the changed core functions (see Important).

Blocking

None.

Important

  • The MATLAB reference run skips the reference tests for several changed core functions. AGENTS.md §Testing says: "trigger .github/workflows/eeglab-reference.yml … or run the suite locally once on the final branch", with the full command pytest tests --eeglab-backend=matlab ….
    • The updated description reports a focused run of 3 files: test_pop_select.py, test_phase1b_file_edit_pop_functions.py and test_gui_pop_select.py.
    • That run leaves out @eeglab_test cases for these changed functions:
      • tests/test_pop_editeventfield_current.py: _apply_options now handles *info before the empty-value delete.
      • tests/test_gui_rejection_dialogs.py: the pop_rejmenu reference case.
      • tests/test_pop_epoch.py: 2 cases.
      • tests/test_pop_comments.py: 3 cases.
      • tests/test_popfunc_dataset_eeglab_tests.py, tests/test_sample_data_pop_functions.py and tests/test_popfunc_visual_eeglab_tests.py.
    • Fix: the workflow dispatch returned 403, so run the full suite on jamming instead: pytest tests --eeglab-backend=matlab --eeglab-root=… --eeglab-suite-root=…. At minimum, add the 7 files above to the focused command. Put the pass/fail/skip counts and runtime in the PR body. A maintainer with dispatch rights can also trigger eeglab-reference.yml on stream2-dialogs.

Nits

None.

Test gaps

None. Each changed behavior has a behavioral test:

  • F44: inclusive endpoints, event retention with one and two trials, the cropped icaact, and the tutorial set with 8 events.
  • F50: dtype is preserved.
  • rejmenu: Calculate, PLOT and Calc/Plot for each method in both data and ICA mode, plus enabled buttons with connected clicked handlers and the ≤1200 px height check.
  • Dialogs: firpm Estimate and its Cancel path, the multi-select epoch picker, comment line breaks, and event-field descriptions and file pickers.

EEGLAB parity notes

None beyond the documented intentional differences (F40 warning, F44 inclusive endpoint, F50 precision). Each one is listed in eeglab_migration.rst and covered by a test.

I could not compare this PR line by line against pop_rejmenu.m, pop_select.m or pop_editeventfield.m: the vendored src/eegprep/eeglab/ tree is missing from this CI checkout. Someone should check by hand that clicking the probability/kurtosis "Scroll" button recalculates before it opens the browser, as EEGLAB does, and that pop_rejtrend gets winsize=EEG.pnts.

@suraj-ranganath
suraj-ranganath marked this pull request as draft November 7, 2026 02:08

@suraj-ranganath suraj-ranganath left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressing the remaining Important item from the re-review: expanded the jamming MATLAB run to every file Claude listed (plus the original three).

Result: 312 passed, 1 skipped, 3 subtests passed in 335.67 s on head 9bb02aef, EEGLAB d0963be9, eeglab_tests fec88f9f, matlab-batch + flock. Files: test_pop_select.py, test_phase1b_file_edit_pop_functions.py, test_gui_pop_select.py, test_pop_editeventfield_current.py, test_gui_rejection_dialogs.py, test_pop_epoch.py, test_pop_comments.py, test_popfunc_dataset_eeglab_tests.py, test_sample_data_pop_functions.py, test_popfunc_visual_eeglab_tests.py.

PR description updated. No code changes. Please re-review; hoping for safe to merge.

@suraj-ranganath
suraj-ranganath marked this pull request as ready for review November 7, 2026 02:08
@claude

claude Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @suraj-ranganath's task in 1m 9s —— View job


Code review

  • Pre-review gate: the PR is ready and open, and the head 9bb02ae matches the checkout. This is the same head as the last two reviews, and the author asked for a re-review.

  • Gather context and diff

  • Review passes: AGENTS.md compliance, conventions, correctness, EEGLAB parity

  • Validate findings and post review

  • Overall assessment: Looks good. I found no code defects, and the reference-run gap from the earlier reviews is closed. I checked:

    • pop_select epoch crop:
      • The trial-selection block rebases latencies using the pre-crop pnts.
      • The crop block keeps that value as old_pnts, so each event's local latency is computed from the original epoch length.
      • An event is kept only if it falls inside a..b, endpoints included, and is then rebased with (a-1) and the new pnts.
      • xmin/xmax now snap to the sample grid, and icaact is cropped along with the data.
    • pop_rejmenu:
      • The disprej checkbox tags manual, thresh, const, jp, kurt and freq match the DEFAULT_REJECTION_COLORS keys, so the browser's disprej reflects the ticked families.
      • store() uses EEG.clear()/update() on the copied EEG, so the color, scroll and action callbacks all keep pointing at the same dict, and Cancel still throws the copy away.
      • Commands accumulate in order: actions run in the dialog, then eeg_rejsuperpose, then pop_rejepoch.
      • matplotlib is already a core dependency, and other pop_* modules import pyplot at the top of the file too.
    • pop_editeventfield:
      • Applying *info before the empty-value delete fixes a latent bug: an empty ("typeinfo", "") used to delete a field named typeinfo.
      • Descriptions are now keyed by the include_urevent field order.
      • A value that is an existing file path is passed to the file loader, as EEGLAB does.
    • pop_selectevent:
      • Numeric criteria are converted only when every non-boundary event type is numeric.
      • The empty-selection warning says what went wrong and how to fix it, as the error-message rules require.
    • Qt and spec:
      • field_text turns MATLAB 2-D char arrays into one line of text per row.
      • setPlainText keeps the comment line breaks.
      • The label_first_line description buttons work.
      • The pop_firpmord(gui=True) path returns when the sub-dialog is cancelled.
  • Highest-risk area: event latency and xmax recalculation in the pop_select epoch crop (src/eegprep/functions/popfunc/pop_select.py:394-411). The new tests and the MATLAB reference cases cover it.

  • Merge recommendation: Safe to merge once a human approves it. AGENTS.md requires human approval for PRs that change core functions.

Blocking

None.

Important

None. The expanded MATLAB backend run covers the @eeglab_test files for every changed core function: 312 passed, 1 skipped, 335.67 s on 9bb02ae, against EEGLAB d0963be9 and eeglab_tests fec88f9f. AGENTS.md asks for the full suite or an eeglab-reference.yml dispatch. The dispatch returned 403 for this token, so a maintainer with dispatch rights may still want to run it before approving. It is not a code issue.

Nits

None.

Test gaps

None. Each changed behavior has a behavioral test:

  • F44: the inclusive endpoints, the 8 tutorial-set events, event retention with and without trial selection, and the cropped icaact.
  • F50: the input dtype is preserved.
  • pop_rejmenu: Calculate, PLOT and Calc/Plot for each method in both data and ICA mode, plus the button wiring and the height check.
  • Dialogs: firpm Estimate and its Cancel path, the multi-select epoch types, the comment line breaks, and the event-field descriptions and file pickers.

EEGLAB parity notes

None beyond the documented intentional differences: the F40 warning, the F44 inclusive endpoint (129 points in EEGPrep vs 128 in EEGLAB), and F50 precision. Each is listed in eeglab_migration.rst and covered by a test.

The vendored src/eegprep/eeglab/ tree is missing from this CI checkout, so I couldn't compare the pop_rejmenu.m Scroll/Calc semantics line by line. The MATLAB reference run above covers test_gui_rejection_dialogs.py.

Checked for correctness bugs, EEGLAB parity, data structure compatibility, changed-behavior tests, and CLAUDE.md/AGENTS.md compliance.

@suraj-ranganath
suraj-ranganath marked this pull request as draft November 7, 2026 02:23
@suraj-ranganath
suraj-ranganath marked this pull request as ready for review November 7, 2026 02:23
@claude

claude Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @suraj-ranganath's task in 45s —— View job


Code review

  • Pre-review gate: the PR is open and ready, and the head 1f55639 matches the checkout. Two commits were added after the last review on 9bb02ae, and the PR was marked ready again, so I reviewed them.

  • Gather context and diff (9bb02ae..1f55639; the earlier commits were covered by the previous reviews)

  • Review passes: AGENTS.md compliance, conventions, correctness, EEGLAB parity

  • Validate findings and post review

  • Overall assessment: Looks good. The new commits remove the compact matplotlib statistics plot (_plot_statistics). PLOT for probability and kurtosis now runs the same code as the Scroll button next to it (pop_rejmenu.py:404): it calculates marks, sets disprej from the ticked families, and opens open_epoched_rejection_browser with store as the callback. I checked:

    • Leftover code: neither pop_rejmenu.py nor test_gui_rejection_dialogs.py imports matplotlib/plt anymore, and the removed _plot_statistics has no remaining callers.

    • Cancel and history: PLOT reuses the existing store closure, so marks and commands build up on the copied EEG the same way they do for Scroll. Cancel still discards them.

    • Test: test_rejmenu_plot_opens_browser_with_calculated_marks covers both data and ICA mode for both methods. It checks:

      • the browser's data: raw data, or the activations for icaweights = 3·I
      • that the browser's winrej maps back through eegplot2trial to rejjp/rejkurt and their …E matrices
      • the trial-count label

      These are behavioral assertions, not a rebuild of the implementation. The browser is closed in finally, so it can't leak into later tests.

    • Docs: changelog.rst, eeglab_migration.rst, gui_console_session.rst and resources/help/pop_rejmenu.md all say that PLOT now opens the browser and that rejstatepoch is not ported. The PR body says the same.

  • Highest-risk area: none new. The pop_select epoch crop from the earlier commits was the riskiest change, and the previous MATLAB run covered it.

  • Merge recommendation: Safe to merge once a human approves.

Blocking

None.

Important

None. The new commits only change GUI dispatch inside pop_rejmenu, not numeric code. The earlier MATLAB backend run (312 passed, 1 skipped, on 9bb02ae) covered test_gui_rejection_dialogs.py, but that run predates these commits. A maintainer with dispatch rights can still trigger eeglab-reference.yml on the final head before approving.

Nits

None.

Test gaps

None.

EEGLAB parity notes

None. PLOT and Scroll now do the same thing for probability and kurtosis. That is a documented difference from EEGLAB, where PLOT opens rejstatepoch, and the new test covers it. The vendored src/eegprep/eeglab/ tree is missing from this CI checkout, so I couldn't compare against pop_rejmenu.m line by line.

Checked for correctness bugs, EEGLAB parity, data structure compatibility, changed-behavior tests, and CLAUDE.md/AGENTS.md compliance.

Copy link
Copy Markdown
Member Author

Thanks for the re-review on 1f556398.

Agreed on the PLOT change: the compact matplotlib statistics path was not Suraj-approved. PLOT for probability/kurtosis now calculates marks and opens the scroll rejection browser (same path as Scroll). EEGLAB's interactive rejstatepoch remains unported and is documented in eeglab_migration.rst / help.

F44 inclusive endpoints (129 vs EEGLAB 128) were re-verified on jamming against pinned EEGLAB 8ac485f6 (pop_select → epoch() upper-exclusive; epoch.m documents the off-by-one). Kept as the documented-correct behavior with the existing test.

No code changes requested in this review. Not merging without Suraj's explicit approval.

@suraj-ranganath
suraj-ranganath merged commit 1bdd1a2 into develop Nov 7, 2026
11 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.

[Release readiness] Stream 2: Dialogs and Edit selection

1 participant