You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Phase 4: Time-frequency internals and legacy time-frequency entry points #135
Phase 4: Time-Frequency Internals And Legacy Time-Frequency Entry Points
Summary
Complete the useful EEGLAB time-frequency stack and related legacy entry points. This phase should make current pop_newtimef and pop_newcrossf behavior meaningfully closer to EEGLAB while keeping EEGPrep standalone.
Can start after Phase 1 merges. Can run in parallel with Phases 2 and 3.
Duplicate-work preflight (no overlapping PRs/issues)
Survey current EEGPrep time-frequency surface
Post research + proposed approach (no PR — this is a >100 line, multi-module phase epic)
Research
Phase 4 is a multi-module port spanning EEGLAB's timefreqfunc/ stack plus legacy pop_* entry points; it depends on Phase 1 (#132) which is still open, so the porting contracts and parity-matrix rows this work must update do not yet exist. Current EEGPrep ships only a deterministic ERSP/ITC core in newtimef and a phase-coherence-only newcrossf; all EEGLAB-style significance, baseline normalization, time-warp, curve plots, and the lower-level timefreq/bootstat/correct_mc/newtimefbaseln helpers are absent. pop_timef and pop_crossf legacy wrappers are not present at all — the in-scope decision (port vs. consolidate vs. stale_skip) belongs to the Phase 1 matrix.
Relevant code
src/eegprep/functions/timefreqfunc/newtimef.py#L26-L86 — current ERSP/ITC entry point, divisive/log baseline only
src/eegprep/functions/timefreqfunc/newcrossf.py#L42-L82 — phasecoher/coher/crossspec only; other types raise
src/eegprep/functions/popfunc/pop_newtimef.py#L227-L241 — _reject_unsupported_options enumerates the gap (timewarp, rboot/pboot/erspboot/itcboot, alpha≠0, basenorm, trialbase, plottype≠image)
src/eegprep/functions/popfunc/pop_newcrossf.py#L167-L174 — same pattern for crossf (rboot, boottype, baseboot, condboot, shuffle, subitc, amplag, alpha)
tests/test_phase4_timefreq_statistics.py#L1-L40 — existing Phase 4 surface tests to extend
Proposed Approach
Scope is too large for one PR. Recommend splitting into ~5 sequential sub-PRs, each landed only after Phase 1 (#132) merges and the parity-matrix rows for timefreqfunc/* are committed.
Foundation: port timefreq (windowed-DFT + Morlet wavelet dispatcher) as a private helper under functions/timefreqfunc/, refactor newtimef/newcrossf to call it. No user-facing behavior change. Numerical parity test against MATLAB timefreq on a fixed-seed signal. (~300-400 lines.)
Baseline normalization + newtimefbaseln: implement basenorm=on, trialbase=full/trial, and the four _BASELINE_CHOICES modes in pop_newtimef.py#L270-L275. Drop the _reject_unsupported_options clauses for basenorm/trialbase. MATLAB parity tests per mode. (~300 lines.)
Bootstrap + multiple-comparison: port bootstat and correct_mc as new functions/timefreqfunc/ modules; wire alpha, rboot/pboot/erspboot/itcboot, boottype, baseboot, condboot, shuffle through both pop wrappers. Parity tests with fixed RNG seed; tolerances documented per AGENTS.md. (~500-700 lines.)
Plot variants + remaining newcrossf types: implement curve plots (plottype='curve'), subitc, amplag. Matplotlib/Qt headless via matplotlib.use("Agg"). GUI visual parity captures for any dialog change. (~300 lines.)
Legacy entry points: pop_timef/pop_crossf (and bare timef/crossf if the Phase 1 matrix marks them port rather than consolidated into the new* variants). timewarp/timewarpms/timewarpidx likely belong here too. (~300-500 lines.)
Each sub-PR must update the Phase 1 parity-matrix rows it touches, add return_com=True history coverage in tests/test_console_workspace.py where pop wrappers gain options, and run lint + ty check + uv run pytest -m "not slow" per AGENTS.md.
Open questions for a human before implementation starts:
Does Phase 1 classify pop_timef/pop_crossf/timef/crossf as port or consolidated (into pop_newtimef/pop_newcrossf)? Affects sub-PR 5 entirely.
MATLAB parity tolerance budget for bootstrap statistics — Phase 1 should set this; otherwise sub-PR 3 will have to pick one.
Are MATLAB Engine/Octave runners available in CI for bootstrap parity tests, or should those be @pytest.mark.matlab skip-when-absent only?
Not opening a PR — this needs human direction on sub-PR breakdown and Phase 1 dependency resolution before any code lands.
🤖 Resolved by the work now included in PR #152. Closing this constituent phase/follow-up issue now; parent epic #131 remains open until the epic PR merges.
Activity
claude commentedon Jun 5, 2026
🤖 Plan:
Research
Phase 4 is a multi-module port spanning EEGLAB's
timefreqfunc/stack plus legacypop_*entry points; it depends on Phase 1 (#132) which is still open, so the porting contracts and parity-matrix rows this work must update do not yet exist. Current EEGPrep ships only a deterministic ERSP/ITC core innewtimefand a phase-coherence-onlynewcrossf; all EEGLAB-style significance, baseline normalization, time-warp, curve plots, and the lower-leveltimefreq/bootstat/correct_mc/newtimefbaselnhelpers are absent.pop_timefandpop_crossflegacy wrappers are not present at all — the in-scope decision (port vs. consolidate vs.stale_skip) belongs to the Phase 1 matrix.Relevant code
src/eegprep/functions/timefreqfunc/newtimef.py#L26-L86— current ERSP/ITC entry point, divisive/log baseline onlysrc/eegprep/functions/timefreqfunc/newcrossf.py#L42-L82—phasecoher/coher/crossspeconly; other types raisesrc/eegprep/functions/popfunc/pop_newtimef.py#L227-L241—_reject_unsupported_optionsenumerates the gap (timewarp, rboot/pboot/erspboot/itcboot, alpha≠0, basenorm, trialbase, plottype≠image)src/eegprep/functions/popfunc/pop_newcrossf.py#L167-L174— same pattern for crossf (rboot, boottype, baseboot, condboot, shuffle, subitc, amplag, alpha)tests/test_phase4_timefreq_statistics.py#L1-L40— existing Phase 4 surface tests to extendProposed Approach
Scope is too large for one PR. Recommend splitting into ~5 sequential sub-PRs, each landed only after Phase 1 (#132) merges and the parity-matrix rows for
timefreqfunc/*are committed.timefreq(windowed-DFT + Morlet wavelet dispatcher) as a private helper underfunctions/timefreqfunc/, refactornewtimef/newcrossfto call it. No user-facing behavior change. Numerical parity test against MATLABtimefreqon a fixed-seed signal. (~300-400 lines.)newtimefbaseln: implementbasenorm=on,trialbase=full/trial, and the four_BASELINE_CHOICESmodes inpop_newtimef.py#L270-L275. Drop the_reject_unsupported_optionsclauses for basenorm/trialbase. MATLAB parity tests per mode. (~300 lines.)bootstatandcorrect_mcas newfunctions/timefreqfunc/modules; wirealpha,rboot/pboot/erspboot/itcboot,boottype,baseboot,condboot,shufflethrough both pop wrappers. Parity tests with fixed RNG seed; tolerances documented per AGENTS.md. (~500-700 lines.)newcrossftypes: implement curve plots (plottype='curve'),subitc,amplag. Matplotlib/Qt headless viamatplotlib.use("Agg"). GUI visual parity captures for any dialog change. (~300 lines.)pop_timef/pop_crossf(and baretimef/crossfif the Phase 1 matrix marks themportrather thanconsolidatedinto thenew*variants).timewarp/timewarpms/timewarpidxlikely belong here too. (~300-500 lines.)Each sub-PR must update the Phase 1 parity-matrix rows it touches, add
return_com=Truehistory coverage intests/test_console_workspace.pywhere pop wrappers gain options, and run lint +ty check+uv run pytest -m "not slow"per AGENTS.md.Open questions for a human before implementation starts:
pop_timef/pop_crossf/timef/crossfasportorconsolidated(intopop_newtimef/pop_newcrossf)? Affects sub-PR 5 entirely.@pytest.mark.matlabskip-when-absent only?Not opening a PR — this needs human direction on sub-PR breakdown and Phase 1 dependency resolution before any code lands.
suraj-ranganath commentedon Jun 7, 2026
🤖 Resolved by the work now included in PR #152. Closing this constituent phase/follow-up issue now; parent epic #131 remains open until the epic PR merges.