Skip to content

[Parity] Add Phase 2 file channel-location workflows - #142

Merged
suraj-ranganath merged 3 commits into
feature/eeglab-core-parity-completionfrom
phase/2-file-channel-location
Jun 5, 2026
Merged

suraj-ranganath merged 3 commits into
feature/eeglab-core-parity-completionfrom
phase/2-file-channel-location

Conversation

@suraj-ranganath

Copy link
Copy Markdown
Member

Implement standalone EEGLAB-style channel-location readers, writers, conversion, recentering, correspondence, BCI, and SnapMaster imports with focused regression coverage. Update pop_chanedit to share the parser/writer, add help/docs, and classify obsolete long-tail rows in the parity matrix.

Fixes #133
Part of #131

@claude

claude Bot commented Jun 5, 2026 •

Copy link
Copy Markdown
Contributor

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


Code review

  • Overall assessment: Looks good with one important latent fix. Well-structured ports with strong, behavior-focused test coverage.
  • Highest-risk area: pop_chancoresp fiducial alias mapping.
  • Merge recommendation: Safe to merge after fixing the LPA/RPA ↔ FidT9/FidT10 swap (latent, not test-covered).

Reviewed against origin/feature/eeglab-core-parity-completion. Checked correctness, EEGLAB parity, EEG-dict/data-structure handling, 1-based index boundaries, and test coverage. Verified the new __init__.py lazy exports, that the referenced packaged montages (egi-gsn-hydrocell-129/257, standard-10-5-342ch) exist, and that eeg_from_data accepts the kwargs used by pop_loadbci/pop_snapread.

Blocking

None.

Important

  • pop_chancoresp.py:11 — fiducial aliases look swapped. FIDUCIAL_ALIASES groups lpa with fidt10 and rpa with fidt9. By the 10‑10 convention (odd=left, even=right) and this repo's own coregister.py:461-463 ("fidt9": "lpa", "fidt10": "rpa"), LPA should pair with FidT9 and RPA with FidT10. A montage labeled with FidT9/FidT10 would pair to the wrong side under autoselect='fiducials'. Latent because tests only use LPA/RPA/nasion. [Inline suggestion posted.] Fix this →

Nits

  • .notes/implementation-notes.html (new file). .gitignore excludes .notes/* except .gitkeep and eeglab-migration-gap-audit.md, so this was force-added. It duplicates the parity-matrix documentation and reads like working notes — consider dropping it (git rm --cached) to keep .notes/ ignored as intended. [Inline note posted.]

Test gaps

  • Fiducial mapping: add a pop_chancoresp(..., 'autoselect', 'fiducials') case using FidT9/FidT10 (not just LPA/RPA) — this is exactly the path that would have caught the swap above.
  • Otherwise coverage is good: round-trips for .locs/.ced, custom-format reordering + 1-based readchans, malformed-row rejection, floatread/floatwrite, snapread event detection, console history sync, and GUI cancel path are all exercised.

EEGLAB parity notes

  • pop_loadbci keeps BCI2000 state columns as data channels (e.g. the State column becomes a channel) rather than parsing state variables into events as EEGLAB does. This is intentional and documented in the implementation notes as a scoped import surface, but EEGLAB users importing real BCI2000 files will see extra "channels". Fine to defer; worth a one-line mention in pop_loadbci.md/docs so the deviation is discoverable at runtime.
  • convertlocs cart/sph/topo round-trips and the 1-based omitchans/readchans/elecind handling match EEGLAB semantics. The cart2all path correctly leaves original Cartesian values untouched and only fills derived fields.

from eegprep.functions.popfunc._pop_utils import format_history_value, parse_key_value_args, parse_numeric_sequence


FIDUCIAL_ALIASES = (("nz", "nasion", "fidnz"), ("lpa", "left", "fidt10"), ("rpa", "right", "fidt9"))

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.

Severity: important — The LPA/RPA ↔ FidT9/FidT10 groupings look swapped. By the 10-10 convention (odd = left, even = right), LPA (left preauricular) pairs with FidT9 and RPA pairs with FidT10. This codebase already encodes that canonical mapping in coregister.py ("fidt9": "lpa", "fidt10": "rpa").

As written, a montage labeled with FidT9/FidT10 would be paired to the wrong side during autoselect='fiducials'. The current tests only exercise LPA/RPA/nasion, so this is latent.

Suggested change
FIDUCIAL_ALIASES = (("nz", "nasion", "fidnz"), ("lpa", "left", "fidt10"), ("rpa", "right", "fidt9"))
FIDUCIAL_ALIASES = (("nz", "nasion", "fidnz"), ("lpa", "left", "fidt9"), ("rpa", "right", "fidt10"))

@@ -0,0 +1,36 @@
<!doctype html>

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.

Severity: nit — .gitignore excludes .notes/* except .gitkeep and eeglab-migration-gap-audit.md, so this file had to be force-added. These design notes duplicate what's already captured in the parity matrix doc and read like agent working notes. Consider dropping it from the PR (git rm --cached .notes/implementation-notes.html) to keep .notes/ ignored as intended.

@suraj-ranganath
suraj-ranganath merged commit a7a42da into feature/eeglab-core-parity-completion Jun 5, 2026
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