Skip to content

EEG noise reduction with ASR #7479

Closed
Closed

Description

@BCIstorm

I'm using Python for signal processing and would like to use the Artifact Subspace Reconstruction (ASR) algorithm ([https://sccn.ucsd.edu/wiki/Artifact_Subspace_Reconstruction_(ASR)]) to detect and remove EEG noise.
Is there a Python implementation of the ASR algorithm?
Thanks

Activity

  1. agramfort commented on Mar 19, 2020

    @agramfort
    SponsorMember

    @BCIstorm this is not available per se in MNE but we have bits and pieces.

    we have OTP https://mne.tools/stable/auto_examples/preprocessing/plot_otp.html
    there is autoreject https://autoreject.github.io/
    etc.

    if you absolutely want this feature you'll need to give a try to implementing it. I am not closing this issue as It can be seen as a feature request

  2. jonathanjfshaw commented on Apr 22, 2020

    @jonathanjfshaw
  3. nbara commented on Apr 23, 2020

    @nbara
    Contributor

    @jonathanjfshaw I wasn't aware of this one.

    I also have a working (AFAICT), but poorly documented version on my computer. It does both ASR and the riemannian variant (in my experience they give very similar results). I will try to clean it up and upload it to github in the next couple weeks.

    EDIT: I had a closer look and those guys seem to be doing it well! Code looks neat. I just don't know how dependent it is to the timeflux ecosystem or whether it can be used independently? I will post my code anyway since it doesn't depend on any third party library, and if, anything, it'll give them a point of comparison.

  4. nbara commented on May 1, 2020

    @nbara
    Contributor

    As promised, I uploaded my code to my github page (see here).

    It's still a bit rough around the edges and the riemannian variant is experimental*. To be honest I haven't found ASR super helpful. It sure does look compelling visually, but at least in my case it didn't make a big difference in my decoding results. Still I'm happy if it helps anyone.

    Details * because I had to fiddle around with pymanopt to create a non-linear eigenspace decomposition, which is not 100% tested.
  5. agramfort commented on May 1, 2020

    @agramfort
    SponsorMember
  6. nbara commented on May 2, 2020

    @nbara
    Contributor
  7. agramfort commented on May 2, 2020

    @agramfort
    SponsorMember
  8. doctorgt commented on Nov 18, 2020

    @doctorgt

    Hi nbara,

    your implementation of ASR is really interesting. However, I still do not understand the documentation you wrote for it in the MEEGKIT, even when I saw the example of its use. Could you help me a little? I want to learn how to use it like in EEGLAB, input the raw eeg I want to clean and get the raw cleaned from artifacts (deleted from the data, no substituting it).

  9. DiGyt commented on May 28, 2021

    @DiGyt
    Contributor

    For anyone who's interested in integrating the ASR method into MNE-Python, please give us a sign by commenting/reacting to this thread.

    This will help me and the devs to judge whether including and maintaining ASR in MNE is worth the effort.

  10. doctorgt commented on May 28, 2021

    @doctorgt

    I really would like to have ASR included in MNE-Python. I am trying to translate from EEGLAB to Python, but since I do not know MATLAB is almost impossible to me.

  11. nbara commented on May 28, 2021

    @nbara
    Contributor

    I am a bit ambivalent. As stated in #9302, I feel it's mostly an online method, for which MNE-python is not necessarily well equipped. Also, I have yet to see a proper comparison between ASR and other denoising techniques in terms of SNR or decoding performance. In my experience ASR looks great upon visual inspection, but I am not 100% convinced. I would be happy to be proven wrong though.

    @doctorgt Just out of curiosity, do you use ASR offline? Have you made any quantitative comparison with/without ASR and found a clear benefit?

  12. doctorgt commented on May 28, 2021

    @doctorgt

    @nbara yes I have used it offline. i am a neurofeedback practitioner and QEEG experte and i compared an ASR artifacted EEG with a manual artifacted EEG (done by me). It was shocking to see QEEG results (processed with Neuroguide software) were almost 100% between in both manual artifacted and ASR artifacted. I need it on Python!!

  13. DiGyt commented on May 29, 2021

    @DiGyt
    Contributor

    Also, I have yet to see a proper comparison between ASR and other denoising techniques in terms of SNR or decoding performance. In my experience ASR looks great upon visual inspection, but I am not 100% convinced. I would be happy to be proven wrong though.

    Completely agree. I created a more or less systematic (but not exhaustive) notebook that compares ASR performance with other cleaning/preprocessing techniques on three EEG datasets. Looks like ASR doesn't exceedingly improve ERPs / SNR assumed from the average signal, but it seems to have some edge over other cleaning techniques when it comes to different decoding tasks...

    I will share the notebook here after it's cleaned and commented...

  14. DiGyt commented on Jun 14, 2021

    @DiGyt
    Contributor

    Soo, here is a link to my comparison of a few automated cleaning methods.

    https://digyt.github.io/automated_EEG_cleaning_comparison/

    It's far from exhaustive and perfectly valid, as this would imply more variable data and more computing power (definitely going beyond an online Google Colab Script). Other limitations are named in the notebook.

    However, as far as this allows me to draw conclusions, I would say the following about Artifact Subspace Reconstruction:

    • Artifact Subspace Reconstruction seems to work surprisingly bad if you want to investigate "ERP-like" signal-to-noise ratio, but it improves decoding accurary for tasks which are not based on the average signal. This should be a very welcome contrast as most other automated cleaning techniques are more or less explicitly designed towards minimizing deviation from the average signal/ERP.
    • The presented algorithm for Artifact Subspace Reconstruction is working on raw data and has the potential to fully interpolate data (of course this doesn't necessarily improve the signal). Both are factors that make it more flexible related to algorithms that require epochs or pseudo-epochs to work. Of course exclusion can be a better choice than interpolation, but an option for simply marking/excluding bad segments can easily be added.
    • A secondary argument is that the riemannian variant (which can be now implemented as pyriemann seems to have no more compatibility issues with the newest scipy) is reported to perform better than the standard (/euclidean) version. Again one also could argue that this is already implemented as the standard cleaning plugin in EEGLab and used by some people.

    So, in brief I would say that ASR is no "superhuman" cleaning algorithm, but from my point of view it definitely has its use cases, and could fill some gaps especially in the Python cleaning landscape.

  15. DiGyt commented on Oct 24, 2022

    @DiGyt
    Contributor

    Note for people who want to use ASR with MNE-Python:

    Integration of ASR into the MNE incubator is under discussion in #9302.

    Until then, a MATLAB-like and MNE-Python-compatible version of vanilla ASR can be found here:
    https://github.com/DiGyt/asrpy

    ASR, rASR, and other denoising algorithms can be found in @nbara's beautiful Python-MEEGkit:
    https://github.com/nbara/python-meegkit

  16. larsoner commented on Oct 24, 2022

    @larsoner
    Member

    Closing for #9302

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions