Repository navigation
Add cart2topo coordinate conversion - #44
suraj-ranganath wants to merge 1 commit into
Conversation
Code Review: Add cart2topo coordinate conversionOverall: This is a clean, minimal port of EEGLAB's
|
| Category | Finding |
|---|---|
| Correctness | ✅ Math is accurate, NaN/empty/error paths work |
| Style | Minor: import order, redundant cast, docstring range |
| Tests | Good coverage; test_matrix_input tautological but parity tests compensate |
| Performance | ✅ Fully vectorised, no Python loops |
| Security | ✅ No concerns |
This is ready to merge with the nits addressed or deferred as follow-ups — the implementation and test suite are sound.
Summary
This PR ports EEGLAB's current
cart2topocoordinate conversion behavior to Python in EEGPREP.Changes:
eegprep.cart2topo.cart2topofor converting Cartesian channel coordinates to EEGLAB topoplottheta/radiuscoordinates.N x 3coordinate arrays and separatex, y, zcoordinate vectors.cart2topofrom the top-leveleegprepnamespace for compatibility with existing EEGPREP function patterns.thetaandradiusagainst EEGLAB'scart2topo.Notes
Current EEGLAB
cart2topo.mhas deprecated documentation for GUI/squeeze/center options, but the active implementation rejects additional parameters and delegates toconvertlocs(..., 'cart2all'). This Python port implements that active non-GUI behavior.Validation
python -m pytest tests/test_cart2topo.py -qpassed:9 passedpython -m pytest tests/test_topoplot.py tests/test_cart2topo.py -qpassed:38 passed, 2 subtests passed