feat(viz): Add DSS/benchmark/zapline visualization modules and theme + enhance examples (closes #22)#24
Draft
snesmaeili wants to merge 17 commits intomainfrom
Draft
feat(viz): Add DSS/benchmark/zapline visualization modules and theme + enhance examples (closes #22)#24snesmaeili wants to merge 17 commits intomainfrom
snesmaeili wants to merge 17 commits intomainfrom
Conversation
…ess issues - Fix isinstance union-type calls to use X | Y syntax (Python 3.10+) - Replace garbled Unicode placeholders with proper characters - Add _PUB_RC dict, use_style() context manager, _apply_style(), _finalize_fig() - Add METHOD_COLORS dict and _get_color() helper - Centralize all hardcoded colors to COLORS/METHOD_COLORS refs - Standardize return types: zapline functions now return Figure (not Axes) - Add fname parameter to all public plot functions for file saving - Rename benchmark save_path to fname for MNE-like consistency - Export new public API: METHOD_COLORS, use_style, _apply_style, _finalize_fig - Fix syntax error (double comma) in dss.py - Update tests: fix Axes->Figure assertions, add theme/helper smoke tests
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #24 +/- ##
==========================================
- Coverage 90.27% 89.04% -1.23%
==========================================
Files 32 41 +9
Lines 2622 4894 +2272
Branches 465 884 +419
==========================================
+ Hits 2367 4358 +1991
- Misses 145 336 +191
- Partials 110 200 +90
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Bug fixes: - Export _get_color in viz/__init__.py - Fix string channel picks crash in plot_time_course_comparison - Handle above-Nyquist frequencies in peak_attenuation_db (return NaN) New modules: - mne_denoise/qa/__init__.py — QA metrics package - mne_denoise/qa/metrics.py — peak_attenuation_db function New scripts: - scripts/visual_qa.py — comprehensive QA testing all 37 viz functions on real Runabout data (36/37 pass; plot_dss_comparison needs future DSS n_select/smooth/segmented params)
Review fixes from Nature Methods-style audit: - comparison.py: replace hardcoded 'k'/'r'/'b' with COLORS['before']/COLORS['after'] - components.py: replace 'steelblue'/'gray' with COLORS['primary']/COLORS['muted'] - zapline.py: replace plt.cm.tab10 with Wong (2011) palette from COLORS dict - dss.py: add fname param to all 5 public plot functions, use _finalize_fig - zapline.py: add fname param to 4 dashboard functions, use _finalize_fig - _theme.py: _finalize_fig closes figure after save when show=False - __init__.py: remove private helpers from __all__ - qa/metrics.py: add TODO for 6 missing QA metric functions All 322 tests pass.
…lues\n\nNew module `mne_denoise.viz.erp` with 5 pub-quality ERP benchmark\nvisualizations:\n - plot_erp_signal_diagnostics: 3×2 QA dashboard (PSD / evoked / diff wave)\n - plot_condition_interaction: diff waves + Hedges' g interaction plot\n - plot_metric_violins: violin + swarm + paired lines (generic)\n - plot_endpoint_summary: multipanel violins + null CI + paired slopes\n - plot_pipeline_slopes: multi-metric subject-level trajectories\n\nAlso fixes:\n - components.py: handle 2-D eigenvalues in plot_narrowband_scan peak marker\n\nAll 322 tests pass."
- Add 12 cells (Section 11) to viz_showcase.ipynb demonstrating all 5 ERP benchmark functions with synthetic data - Fix seaborn FutureWarning: add hue='Group', legend=False to all violinplot/stripplot calls in plot_metric_violins & plot_endpoint_summary - Replace deprecated set_xticklabels with tick_params in both functions - Add module-level warnings.filterwarnings in erp.py for residual seaborn palette warnings - Update Summary table with ERP Benchmark row
New functions in mne_denoise/viz/erp.py: - plot_grand_average_erp: group-mean evoked +/- between-subject SEM - plot_grand_condition_interaction: condition x pipeline with group error bars - plot_null_distribution: permutation null histogram + observed statistic - plot_forest: per-subject effect-size forest plot with CI Updated __init__.py exports (9 ERP functions + 3 constants). Added Section 12 to viz_showcase.ipynb (10 cells, all demos pass).
…lize_fig to auto-create parent directories (mkdir -p)\n before saving figures, preventing FileNotFoundError\n- Add erp_io.py with deferred-group workflow:\n - save_subject_erp_results(): persist evokeds, diff waves,\n effect sizes, and metrics per subject\n - load_subject_erp_results(): read one subject's saved data\n - aggregate_erp_results(): collect all subjects from disk into\n ERPGroupData namedtuple ready for group plot functions\n- Export 4 new symbols from viz __init__.py\n- 322 tests pass, IO round-trip verified"
- tests/test_erp_viz.py: 92 comprehensive tests for erp.py (96% cov), erp_io.py (97% cov), and _theme.py mkdir fix - mne_denoise/viz/erp.py: fix B904 (raise ... from err), fix E402 (move relative import above warnings.filterwarnings calls), ruff format - mne_denoise/viz/erp_io.py: ruff format only (no logic changes) - docs/changes/devel/feature.rst: document ERP functions, erp_io, _finalize_fig fix, and test suite Full suite: 414 passed, 11 skipped
- tests/test_qa_metrics.py: peak_attenuation_db (8 tests) - tests/test_viz_metrics.py: suppression, distortion, variance (9 tests) - tests/test_benchmark_io.py: save/load/aggregate IO (22 tests) - tests/test_viz_benchmark.py: all 9 plot functions + helpers (36 tests) - tests/test_viz_dss.py: DSS helpers + dashboards (35 tests) - tests/test_viz_zapline_extended.py: adaptive/standard summary + helpers (42 tests) - tests/test_utils.py: extract/reconstruct MNE objects (13 tests) - tests/test_averaging.py: AverageBias._apply_datasets (7 tests) - docs/testing.rst: testing documentation page - docs/index.rst: add testing to toctree
- Make pandas imports lazy in benchmark_io.py, erp_io.py, erp.py so viz module can be imported without pandas (fixes docs build) - Add per-file-ignores for scripts/ and run_erp_benchmark.py (D, E402) - Add F404 ignore for examples (notebook __future__ import) - Auto-fix ruff issues: unused imports, sort imports, dict literals, dict comprehensions, set comprehensions, SIM114
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(viz): Add DSS/benchmark/zapline visualization modules and theme + enhance examples
(Recreated from #23 which was accidentally merged)