Repository navigation
Add Phase 4 time-frequency and statistics workflows - #85
Conversation
|
Claude finished @suraj-ranganath's task in 5m 39s —— View job Code review
BlockingNone. Important1. 2. 3. Nits
Test gaps
EEGLAB parity notes
Checked: correctness, EEGLAB parity, data structure compatibility, changed-behavior tests, AGENTS.md compliance, and history-string replay paths. Inline suggestions posted for findings 1–3. |
|
🤖 Implementation spec for Phase 4 time-frequency/statistics. Problem Approach Key code Tests |
|
🤖 Visual parity capture evidence for the new Phase 4 dialogs was generated locally and is intentionally not committed to the repo. Generated side-by-side images:
Capture commands used the repo visual parity harness against EEGLAB and EEGPrep for each case, followed by compare.py report generation. I could not upload these as GitHub user attachments from this environment because the available Chrome DevTools session is logged out of GitHub and gh does not expose GitHub's private user-attachment upload path. |
|
|
||
|
|
||
| def _add_popup_options(options: dict[str, Any], ntimesout: int, nfreqs: int, basenorm: int, freqs: list[float]) -> None: | ||
| ntimes_values = {1: 50, 2: 100, 3: 150, 5: 300, 6: 400} |
There was a problem hiding this comment.
Important — default "Use 200 time points" silently does nothing.
The popup default at line 94 is value=4 (the 4th choice, "Use 200 time points"), but ntimes_values skips key 4 — so for the default GUI run, no timesout is ever written to options and the user gets the natural STFT count instead of 200.
Suggested fix:
| ntimes_values = {1: 50, 2: 100, 3: 150, 5: 300, 6: 400} | |
| ntimes_values = {1: 50, 2: 100, 3: 150, 4: 200, 5: 300, 6: 400} |
Reference:
eegprep/src/eegprep/functions/popfunc/pop_newtimef.py
Lines 94 to 96 in 1c9b2b6
| if bool(result.get("plotcurve", False)): | ||
| options["plottype"] = "curve" |
There was a problem hiding this comment.
Important — this checkbox always crashes the GUI run.
Setting options["plottype"] = "curve" here is then rejected by _reject_unsupported_options at line 227-228 with NotImplementedError("pop_newtimef curve plots are not yet available"). The dialog renders the "Plot curve at each frequency" checkbox as a live option, but any user who checks it triggers an exception from the GUI path.
Either disable/hide the checkbox in pop_newtimef_dialog_spec, or skip writing plottype here and surface the limitation via a clearer GUI-side message before the rejection runs.
| def _event_in_latency_range(EEG: dict[str, Any], event: dict[str, Any], bounds: np.ndarray) -> bool: | ||
| try: | ||
| latency = float(np.asarray(event.get("latency")).squeeze()) | ||
| except (TypeError, ValueError): | ||
| return False | ||
| srate = float(EEG.get("srate", 1) or 1) | ||
| xmin = float(EEG.get("xmin", 0) or 0) | ||
| latency_ms = (latency - 1) / srate * 1000.0 + xmin * 1000.0 | ||
| return bool(bounds[0] <= latency_ms <= bounds[1]) |
There was a problem hiding this comment.
Important — latency-range filter is incorrect for epoched datasets.
EEGLAB stores epoched event.latency as a sample index into the concatenated pnts × trials buffer, so adding the per-epoch xmin offset to a global sample count silently mis-classifies events when the dataset has more than one trial. Continuous data happens to work because xmin == 0.
EEGLAB's eeg_point2lat does the proper per-epoch math; consider delegating to it (or replicating that logic) so this filter behaves correctly for epoched datasets. Worth adding a regression test that exercises latrange against a multi-trial fixture.
Add EEGLAB-style time-frequency, cross-coherence, signal statistics, and event statistics workflows with GUI/menu dispatch, help resources, visual parity cases, and sample-data tests. Removes the remaining channel viewprops placeholder because the non-scrolling channel overview is implemented while browser scrolling remains excluded.
Part of #64