Skip to content

[GUI] Read the EGI segment range and montage choices from the RAW header - #1021

Open
arnodelorme wants to merge 4 commits into
agent/issue-875-file-exportbidsfrom
agent/issue-875-file-readegi
Open

arnodelorme wants to merge 4 commits into
agent/issue-875-file-exportbidsfrom
agent/issue-875-file-readegi

Conversation

@arnodelorme

@arnodelorme arnodelorme commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Continuous RAW recordings open directly. For segmented recordings, the dialog gives the available frame range and lists the montage for the channel count first. The packaged fiducial and sensor coordinates for GSN129.sfp and GSN-HydroCel-257.sfp are available to the standalone reader. Stacked on #997 (agent/issue-875-file-exportbids).

Format or settings window, MATLAB and EEGPrep before and after

Native height differences and histogram of normalized numerical distances

Measurements and verification

Native client geometry on jamming was 793.2 × 311.1 px in MATLAB, 606 × 172 before and 750 × 315 after. Screenshots use each toolkit’s captured frame. Three selections from TESTEGI.RAW covered the first frame, first two and final two frames. EEG samples and event latencies matched exactly across all three scripted reads. Native MATLAB raises an undefined promptstr error after its segmented form, so this numerical comparison used public scripted inputs with no montage. The native window was captured before dismissal. The Qt tests also covered selecting a montage and replaying the resulting command. The focused File menu run passed 55 tests (three deselected). Both source trees passed the capture safeguards.

Closes #1022. Part of #875.

Full inventory report for the project team. pop_readegi (p. 25). PDF · Editable Word.

@arnodelorme

Copy link
Copy Markdown
Collaborator Author

🤖 Review before taking this out of draft.

State. The updated parent (#997) is merged in (251cafb2f). On the Mac 257 tests pass, with the BioSig failure that develop also has on this Mac (BioSig is not installed here). Jamming passes 307 geometry tests.

What I checked against pop_readegi.m lines 72 to 94. The form opens only for a segmented file, the montage list starts with the montage of the channel count and then rotates as in EEGLAB, and rows and heights match ([2 1] [2 1] [1] [1], [1 1 1.5 3]).

Finding that matters for the merge. This pull request is not only a form. It changes sigprocfunc/readegilocs.py: with GSN-HydroCel-257.sfp the first three rows (the fiducials) leave the data channels for 256 and 257 channel recordings, and two EEGLAB montage files are added. That is what readegilocs.m does, but it changes the channel locations a user gets. So this one counts as a core function change: it needs the EEGLAB reference run and Arno's approval before any merge.

Verdict: ready for review, not ready to merge before that run.

@arnodelorme
arnodelorme marked this pull request as ready for review December 2, 2026 05:50

@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 Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @arnodelorme's task in 1m 31s —— View job


Code review

  • Overall assessment: Needs changes. The rest works:
    • The header-driven form opens only for segmented files.
    • The montage list starts with the montage for the channel count and rotates the rest.
    • Selecting a montage and replaying the history command give the same data as a direct scripted read.
    • The new GSN-HydroCel-257.sfp branch in readegilocs splits the channels the way EEGLAB's readegilocs does (256 channels: 3 fiducials + Cz become non-data; 257 channels: only the 3 fiducials).
    • The aliases for GSN65v2_0.sfp and GSN-HydroCel-32.sfp resolve to packaged files, so replaying history works.
  • Highest-risk area: sigprocfunc/readegilocs.py. It changes the channel locations a user gets, so this is a core change.
  • Merge recommendation: Needs changes. After that it still needs the EEGLAB reference run in MATLAB and Arno's approval.

Blocking

None.

Important

  • The help text no longer matches the GUI (src/eegprep/resources/help/pop_readegi.md:3).
    • Line 3 still says gui=True offers "a forced file version, and channel-location selection (auto, a file path, or blank)".
    • The new dialog has no force-version field, uses a montage list instead, and never opens for continuous files.
    • The paragraph this PR added below that line contradicts it.
    • Fix: limit line 3 to the scripted arguments (datachunks, forceversion, fileloc). A suggestion is posted inline.
  • The last line of the note is cut off (pop_readegi.py:320, geomvert=(1, 1, 1.5, 3)).
    • In the "EEGPrep after" screenshot, the line "The listed channel location files are included with EEGPrep." is cut off at the bottom.
    • Fix: make the note row taller (for example 3.5), or shorten the text to 4 lines. Then capture the dialog again.

Nits

None.

Test gaps

  • The new readegilocs branch for GSN-HydroCel-257.sfp has no test. The only new test uses 129 channels with GSN129.sfp, so an off-by-three error or a wrong nodatchans split for 256 or 257 channels would go unnoticed. Suggested test in tests/test_egi_raw_eeglab_tests.py:
    • Call readegilocs({"nbchan": 256}, "GSN-HydroCel-257.sfp"). Assert the labels are E1…E256 and the nodatchans labels are FidNz, FidT9, FidT10, Cz.
    • With nbchan=257, assert the last label is Cz and nodatchans holds only the 3 fiducials.

EEGLAB parity notes

  • These match the MATLAB screenshot:
    • the form opens only for segmented files;
    • the montage list starts with the montage for the channel count;
    • there is no Help button;
    • rows and heights are [2 1] [2 1] [1] [1] / [1 1 1.5 3].
  • The vendored src/eegprep/eeglab/ tree is not in this CI checkout. I checked parity against the PR screenshots and EEGLAB's known readegilocs behavior, not line by line against the .m files.
  • AGENTS.md requires the MATLAB reference run (eeglab-reference.yml, or a local run with --eeglab-backend=matlab) for the readegilocs.py change. Put its results in the PR body before merging.

Two inline comments with suggestions are posted on the PR. I could not post the separate gh pr comment summary because writing a temporary file outside the repo was not permitted, so this comment carries the review.

eeglab_source="functions/popfunc/pop_readegi.m",
layout="supergui",
geometry=((2, 1), (2, 1), (1,), (1,)),
geomvert=(1, 1, 1.5, 3),

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.

Important: the last line of the note is clipped. In the "EEGPrep after" screenshot, "The listed channel location files are included with EEGPrep." is cut off at the bottom of the note row. The text has 5 lines, but with Qt's line spacing a height of 3 does not hold them, even though it does in EEGLAB. Fix: make the row taller, or shorten the note to 4 lines. Then capture the dialog again.

Suggested change
geomvert=(1, 1, 1.5, 3),
geomvert=(1, 1, 1.5, 3.5),

@@ -1,3 +1,5 @@
# POP_READEGI - Import EGI Simple Binary

`pop_readegi(filename)` reads continuous or segmented EGI `.raw` files. Use `gui=True` for 1-based frame/segment selection, a forced file version, and channel-location selection (`auto`, a file path, or blank). `return_com=True` returns the dataset and command. Cancel returns an empty command.

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.

Important: this sentence no longer matches the GUI. The dialog has no force-version field. Channel locations are now a montage list, not auto/path/blank. The dialog does not open at all for continuous files. The new paragraph below contradicts this line. Fix: describe only the scripted arguments here and leave the GUI description to the new paragraph.

Suggested change
`pop_readegi(filename)` reads continuous or segmented EGI `.raw` files. Use `gui=True` for 1-based frame/segment selection, a forced file version, and channel-location selection (`auto`, a file path, or blank). `return_com=True` returns the dataset and command. Cancel returns an empty command.
`pop_readegi(filename)` reads continuous or segmented EGI `.raw` files. `datachunks` takes 1-based frame/segment numbers, `forceversion` overrides the header version, and `fileloc` takes `auto`, a montage file, or blank. `return_com=True` returns the dataset and command. Cancel returns an empty command.

This branch has not been deployed

No deployments
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.

1 participant