.. _sphx_glr_auto_examples_asr: ASR Examples ============ Examples demonstrating Artifact Subspace Reconstruction (ASR) for burst-artifact repair in EEG (and MEG) data --- from a basic clean to a full preprocessing pipeline, with each method example grounded in its source paper. Getting started --------------- - ``plot_01_asr_basics.py``: Standard ASR on synthetic multichannel bursts. - ``plot_02_mne_raw_qc.py``: MNE ``Raw`` usage with repair annotations and an optional clean_windows-style final rejection mask. - ``plot_05_asr_visualization.py``: The ASR-specific ``mne_denoise.viz`` plots (repair timeline, component reconstruction, calibration fraction) alongside the generic before/after and PSD helpers. Cutoff and variants ------------------- - ``plot_06_cutoff_tuning.py``: How ``cutoff`` trades data modified against variance removed (Chang 2020). - ``plot_07_riemannian_asr.py``: Riemannian (``method="riemannian_windowed"``) vs standard ASR on real blinks (Blum 2019). - ``plot_03_adaptive_asr.py``: AASR-style streaming with ``fit`` / ``partial_fit`` / ``transform``. - ``plot_08_adaptive_variants.py``: Adaptive ``psp`` vs ``psw`` vs ``mw`` on non-stationary data, with the moving-window adaptation trajectory (Tsai). - ``plot_04_juggler_asr.py``: Juggler DBSCAN calibration on dense short bursts. - ``plot_09_juggler_strategies.py``: Juggler ``dbscan`` vs ``gev`` reference selection under heavy contamination (Kim 2025). - ``plot_10_choosing_a_variant.py``: Standard vs Riemannian vs Juggler on one substrate, with a short recommendation. I/O, QC, and pipelines ---------------------- - ``plot_11_epochs_and_meg.py``: ASR on ``mne.Epochs`` and on MEG magnetometers. - ``plot_12_diagnostics_qc.py``: ``get_diagnostics`` / ``variance_removed`` / ``to_annotations`` and the three ASR diagnostic plots. - ``plot_13_pipeline_filter_asr_ica.py``: A realistic ``filter -> ASR -> ICA`` workflow on real EEG. Experimental research prototypes -------------------------------- - ``plot_15_guided_asr.py``: DSS-guided soft ASR (``GuidedASR``), demonstrated on synthetic data only. .. warning:: ``GuidedASR`` is an unpublished, unvalidated research prototype. Its current evidence is limited to unit tests and synthetic benchmarks. Do not treat it as a validated EEG preprocessing method, and independently verify signal preservation and artifact attenuation for your data. Notes ----- Most examples use synthetic data so they run without downloads; ``plot_07`` and ``plot_13`` (and the MEG part of ``plot_11``) use the MNE *sample* dataset. Apply ASR to real EEG only after bad-channel handling, referencing, and high-pass filtering in the surrounding MNE workflow. .. raw:: html
.. raw:: html
.. thumbnail-parent-div-open .. raw:: html
.. only:: html .. image:: /auto_examples/asr/images/thumb/sphx_glr_plot_01_asr_basics_thumb.png :alt: :doc:`/auto_examples/asr/plot_01_asr_basics` .. raw:: html
Artifact Subspace Reconstruction: Basic Usage.
.. raw:: html
.. only:: html .. image:: /auto_examples/asr/images/thumb/sphx_glr_plot_02_mne_raw_qc_thumb.png :alt: :doc:`/auto_examples/asr/plot_02_mne_raw_qc` .. raw:: html
Artifact Subspace Reconstruction: Raw QC and Annotations.
.. raw:: html
.. only:: html .. image:: /auto_examples/asr/images/thumb/sphx_glr_plot_03_adaptive_asr_thumb.png :alt: :doc:`/auto_examples/asr/plot_03_adaptive_asr` .. raw:: html
Adaptive ASR with chunk updates
.. raw:: html
.. only:: html .. image:: /auto_examples/asr/images/thumb/sphx_glr_plot_04_juggler_asr_thumb.png :alt: :doc:`/auto_examples/asr/plot_04_juggler_asr` .. raw:: html
JugglerASR for dense short bursts
.. raw:: html
.. only:: html .. image:: /auto_examples/asr/images/thumb/sphx_glr_plot_05_asr_visualization_thumb.png :alt: :doc:`/auto_examples/asr/plot_05_asr_visualization` .. raw:: html
Visualizing ASR with mne_denoise.viz
.. raw:: html
.. only:: html .. image:: /auto_examples/asr/images/thumb/sphx_glr_plot_06_cutoff_tuning_thumb.png :alt: :doc:`/auto_examples/asr/plot_06_cutoff_tuning` .. raw:: html
Choosing the ASR cutoff.
.. raw:: html
.. only:: html .. image:: /auto_examples/asr/images/thumb/sphx_glr_plot_07_riemannian_asr_thumb.png :alt: :doc:`/auto_examples/asr/plot_07_riemannian_asr` .. raw:: html
Riemannian ASR versus standard ASR.
.. raw:: html
.. only:: html .. image:: /auto_examples/asr/images/thumb/sphx_glr_plot_08_adaptive_variants_thumb.png :alt: :doc:`/auto_examples/asr/plot_08_adaptive_variants` .. raw:: html
Adaptive ASR variants (PSP / PSW / MW).
.. raw:: html
.. only:: html .. image:: /auto_examples/asr/images/thumb/sphx_glr_plot_09_juggler_strategies_thumb.png :alt: :doc:`/auto_examples/asr/plot_09_juggler_strategies` .. raw:: html
Juggler ASR: DBSCAN vs GEV reference selection.
.. raw:: html
.. only:: html .. image:: /auto_examples/asr/images/thumb/sphx_glr_plot_10_choosing_a_variant_thumb.png :alt: :doc:`/auto_examples/asr/plot_10_choosing_a_variant` .. raw:: html
Choosing an ASR variant.
.. raw:: html
.. only:: html .. image:: /auto_examples/asr/images/thumb/sphx_glr_plot_11_epochs_and_meg_thumb.png :alt: :doc:`/auto_examples/asr/plot_11_epochs_and_meg` .. raw:: html
ASR on Epochs and on MEG.
.. raw:: html
.. only:: html .. image:: /auto_examples/asr/images/thumb/sphx_glr_plot_12_diagnostics_qc_thumb.png :alt: :doc:`/auto_examples/asr/plot_12_diagnostics_qc` .. raw:: html
ASR diagnostics and quality control.
.. raw:: html
.. only:: html .. image:: /auto_examples/asr/images/thumb/sphx_glr_plot_13_pipeline_filter_asr_ica_thumb.png :alt: :doc:`/auto_examples/asr/plot_13_pipeline_filter_asr_ica` .. raw:: html
A realistic pipeline: filter, ASR, then ICA.
.. raw:: html
.. only:: html .. image:: /auto_examples/asr/images/thumb/sphx_glr_plot_14_rms_distribution_thumb.png :alt: :doc:`/auto_examples/asr/plot_14_rms_distribution` .. raw:: html
Quantifying Dataset Noise with RMS Statistics
.. raw:: html
.. only:: html .. image:: /auto_examples/asr/images/thumb/sphx_glr_plot_15_guided_asr_thumb.png :alt: :doc:`/auto_examples/asr/plot_15_guided_asr` .. raw:: html
Guided ASR: preserving neural activity that ASR would over-clean.
.. thumbnail-parent-div-close .. raw:: html
.. toctree:: :hidden: /auto_examples/asr/plot_01_asr_basics /auto_examples/asr/plot_02_mne_raw_qc /auto_examples/asr/plot_03_adaptive_asr /auto_examples/asr/plot_04_juggler_asr /auto_examples/asr/plot_05_asr_visualization /auto_examples/asr/plot_06_cutoff_tuning /auto_examples/asr/plot_07_riemannian_asr /auto_examples/asr/plot_08_adaptive_variants /auto_examples/asr/plot_09_juggler_strategies /auto_examples/asr/plot_10_choosing_a_variant /auto_examples/asr/plot_11_epochs_and_meg /auto_examples/asr/plot_12_diagnostics_qc /auto_examples/asr/plot_13_pipeline_filter_asr_ica /auto_examples/asr/plot_14_rms_distribution /auto_examples/asr/plot_15_guided_asr