Skip to content

pop_editeventvals (Edit > Event values): graphical and numerical parity with EEGLAB #725

Backlog
1 of 1 issue completed

Description

@arnodelorme

EEGPrep checks each EEGLAB function on its own, in one issue, for both the window and the numbers (Arno, November 26, 2026). This issue is pop_editeventvals, the Edit menu item "Event values", from the Edit menu report of November 26, 2026 (EEGPrep develop df89e80 against EEGLAB develop 16cc13212, jamming under Xvfb).

Findings of the report for this function
  • F2: Insert and append: the latency is read in seconds by EEGLAB and stored as samples by EEGPrep, and the urevent goes to the end of the table.
  • F3: 'sort' has no effect in EEGPrep (resorted by eeg_checkset). EEGLAB fails on a two field sort.
  • F14: Minor differences of structure with the same data and events (an eventdescription entry for duration, urevent order, empty keys of a boundary event, the trailing empty slot of pop_delset).
  • F16: The window is taller than its content, and the text of the edit boxes is left aligned (rule 7).
  • F19: Button labels without the unit (latency for Latency (sec)), 2.0 for 2, an extra line "Original value below".

F15, F16, F18, F21 and F24 are shared by several windows: fix them here only for this function's window, under the GUI rules of project_eegprep (rules/gui-parity.md).

Files

Sub-issues

Sub-issues

1 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. added
    later
    gui-parity
    on Nov 27, 2026
  2. claude commented on Nov 27, 2026

    @claude
    Contributor

    🤖 Plan:

    • Fetch issue, check for overlapping PRs (none open for pop_editeventvals)
    • Compare EEGPrep against EEGLAB develop pop_editeventvals.m
    • Implementation: not started. The issue is labeled later (waiting on Arno's Edit menu comments) and covers 5 findings across numerics and GUI (>100 lines), so no PR yet. Analysis below for human review.

    Research

    All three numerical differences (F2, F3, change-latency urevent) come from the command-line path in _apply_options, which does not follow three EEGLAB rules. EEGLAB turns insert/append into changefield calls, so latency goes through seconds→samples. It puts the new urevent at the insertion point and shifts the later indices. It skips eeg_checkset after sort.

    Relevant code

    Proposed Fix

    1. Insert/append (F2): in _apply_options, insert an empty event, then send each value except urevent through _change_field (EEGLAB L125-136). Latency is then read in seconds (ms when epoched) and duration converted. In _allocate_inserted_urevent, take the urevent of the event at or after the insertion point (urvalnum). Insert the new urevent there, keep its epoch, and add 1 to the urevent of every later event (L241-280).

    2. Change latency → urevent (N45/N46): for continuous data, set the urevent latency to eeg_urlatency(EEG.event, new_latency), which adds the boundary durations back. For epoched data, use urlatency(neighbor) - (latency(neighbor) - new), where the neighbor is the event before or after in the same epoch. If there is no such event, leave the urevent unchanged and log it (L356-385).

    3. Sort (F3): when the call has a sort option, return without eeg_checkset, as EEGLAB does with noeventcheck (L474). EEGLAB crashes on a two-field sort: it discards the secondary order and indexes events(I) with the primary order. EEGPrep should keep its working two-field sort and record this as a known difference.

    4. F14: check each structural difference (the duration eventdescription, empty keys of a boundary event) against eeg_checkset once 1–3 are in. Urevent order should match after step 1.

    5. GUI (F16/F19): _display_field_label already returns "Latency (sec)". The report's latency label likely comes from the field-description path; see known_differences, "Field buttons show the field description". Planned changes:

      • Use the unit label on the buttons.
      • Print integers as 2, not 2.0, like EEGLAB's reformat.
      • Drop the "Original value below" row (L144-L146) or replace it with EEGLAB's "originally N" text.
      • Right-align the edit box text.
      • Size the window to its content instead of max(360, 170 + 34*n) (L160).

      This needs the visual-parity capture loop.

    Steps 1–3 come to about 60–80 lines plus tests in tests/test_pop_editeventvals.py, covering N45–N52: latency change on continuous and epoched data, insert/append with urevent, and a single-field sort that keeps its order. They change a core function, so they need the EEGLAB reference run before merge. Step 5 is a separate GUI PR.

    Open questions

    • Should EEGPrep copy EEGLAB's duration handling for the urevent table? EEGLAB converts duration twice there (L335-339 and L391-396), which looks like an EEGLAB bug.
    • Two-field sort: keep EEGPrep's working stable sort (proposed), or match EEGLAB and fail?
    • Should this be split into two PRs, numerics (1–4) and GUI (5), once the later label is removed?
  3. suraj-ranganath commented on Nov 28, 2026

    @suraj-ranganath
    Member

    On develop (aa81d9ab), open Edit > Event values on the continuous tutorial dataset. Replace 1 with 5 in Event Num and press Return. The dialog closes as if Ok was pressed. With Tab, event 5 can be edited and event 1 stays intact.

    Have Return apply the event number and keep the editor open, as the EEGLAB field callback does. Check Return and the previous/next buttons, then save an edit to event 5 and verify that only that event changed. Repeat with Cancel and check the original values and history. This stays with the parked Edit work in #711. pop_editeventvals.m L567 · pop_editeventvals.py L134

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

    gui-paritylater

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions