Skip to content

Unblock native group-level analysis and source localization workflows#254

Open
google-labs-jules[bot] wants to merge 1 commit into
developfrom
jules/unblock-native-workflows-js1-8ef1aaec-1aec-4c14-a4b6-25b477134c26
Open

Unblock native group-level analysis and source localization workflows#254
google-labs-jules[bot] wants to merge 1 commit into
developfrom
jules/unblock-native-workflows-js1-8ef1aaec-1aec-4c14-a4b6-25b477134c26

Conversation

@google-labs-jules

Copy link
Copy Markdown

Context

Researchers using EEGPrep were previously unable to complete end-to-end group-level analyses or basic source localization within the application. Critical UI entry points for STUDY and DIPFIT were blocked by placeholders, forcing users to switch back to MATLAB to perform standard tasks like condition comparison or dipole fitting.

This PR replaces those placeholders with functional implementations, wiring existing internal libraries to the user interface to satisfy basic research needs.

Key Changes

1. STUDY Design & Statistics

  • Functional pop_limo Dialog: Replaced the limitation exception in src/eegprep/functions/studyfunc/pop_limo.py with a functional DialogSpec UI. This allows users to select categorical and continuous independent variables directly within the native interface.
  • Group-Level Stats Extension: Updated the native statistics engine (statcond.py) to handle STUDY dictionary structures. It now uses std_readdata to retrieve condition arrays, enabling permutation tests for group comparisons without external dependencies.

2. Source Localization (DIPFIT)

  • Spherical Model Coregistration: Activated the "Co-register" functionality within the DIPFIT settings. By attaching the headplot_manual_coreg callback, users can now align channel locations to the supported native spherical head model.
  • 2D Dipole Visualization: Implemented a native 2D scatter plot workflow in std_dipplot.py using matplotlib. This replaces the previous plotting placeholders and allows for the visual inspection of dipole clusters.

Rationale & Key Decisions

  • Scope Management: To keep the implementation size manageable and maintain high performance, we deliberately excluded complex BEM fitting and advanced GLM features from the LIMO toolbox. The focus is strictly on native spherical leadfields and basic stats.
  • UI Consistency: All new dialogs were built using the internal DialogSpec system to ensure visual and behavioral parity with the rest of the EEGPrep suite.
  • Numerical Parity: A core requirement was matching MATLAB output within a 1% tolerance. The updated stats engine and dipole coordinate handling have been validated against EEGLAB reference datasets to ensure scientific integrity.

Validation Results

  • pop_limo and pop_dipfit_settings dialogs launch and save state correctly.
  • Internal stats engine successfully processes 2-condition STUDY designs.
  • Dipole coordinates verified against reference benchmarks.
  • End-to-end tests in test_study_end_to_end.py now pass without hitting "Not Implemented" errors.

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.

0 participants