Repository navigation
[Parity] Add time-frequency internals - #143
suraj-ranganath merged 3 commits into
Conversation
|
Claude finished @suraj-ranganath's task in 7m 0s —— View job Code review
I reviewed the core compute paths ( Blocking
Important
Nits
Test gaps
EEGLAB parity notes
|
|
🤖 Phase 4 GUI visual parity captures for the time-frequency dialogs. These were captured on macOS with MATLAB R2026a and the EEGPrep Qt renderer. The comparison reports show size mismatches from native MATLAB/Qt window sizing, so the side-by-sides were inspected for control labels, ordering, defaults, and enabled states. One caveat: the pop_newtimef channels pop_newtimef components pop_newcrossf channels pop_newcrossf components |
| "build_safe_update_commands": ("eegprep.extension_catalog", "build_safe_update_commands"), | ||
| "bundled_plugins": ("eegprep.functions.adminfunc.plugin_menu", "bundled_plugins"), | ||
| "cart2topo": ("eegprep.functions.sigprocfunc.cart2topo", "cart2topo"), | ||
| "chancenter": ("eegprep.functions.sigprocfunc.chancenter", "chancenter"), |
There was a problem hiding this comment.
Blocking — orphaned lazy exports point to modules that don't exist on this branch.
This PR adds ~14 exports unrelated to time-frequency whose target modules/attributes are absent on HEAD: chancenter, convertlocs, floatread, floatwrite, readlocs/readelp/readeetraklocs, readegilocs, snapread, writelocs, and pop_chancenter, pop_chancoresp, pop_loadbci, pop_readlocs, pop_snapread, pop_writelocs. I verified none of these files exist under functions/sigprocfunc/ or functions/popfunc/.
Because they're lazy, import eegprep still succeeds, but any access (eegprep.readlocs, from eegprep import *, etc.) hits importlib.import_module(...) at __init__.py:306 and raises ModuleNotFoundError. They're also in __all__. tests/test_package_exports.py only checks representative names, so CI won't catch this. These also appear out of scope for a "time-frequency internals" PR — likely an accidental paste.
Fix: drop these entries, keeping only the time-frequency exports whose modules this PR actually adds (bootstat, correct_mc, crossf, dftfilt, dftfilt2, dftfilt3, newtimefbaseln, newtimefitc, newtimefpowerunit, newtimeftrialbaseln, timef, timefreq).
| assert result.coherence.shape == result.phase.shape | ||
| assert result.allcoher.shape[2] == 1 | ||
| np.testing.assert_allclose(result.coherence, np.abs(result.allcoher[:, :, 0])) |
There was a problem hiding this comment.
Nit — this rewrite makes the test near-tautological and drops the behavior it claims to check.
The old assertion np.nanmean(result.coherence) < 0.5 made a real numerical claim about single-trial cross-spectrum behavior. The replacement's assert_allclose(result.coherence, np.abs(result.allcoher[:, :, 0])) is an identity that holds by construction regardless of correctness, so the test named ..._switches_to_cross_spectrum no longer verifies the switch. Keep the shape checks, but restore a numerical assertion that distinguishes single-trial cross-spectrum output from the multi-trial coherence path.




Implement Phase 4 time-frequency internals, legacy timef/crossf wrappers, pop_timef/pop_crossf entry points, and supported pop_newtimef/pop_newcrossf option paths. Adds focused compute, history, helper, docs, matrix, and visual parity evidence while deferring timewarp and exact rsfit parity to Phase 7.
Closes #135
Part of #131