Last Year, when I started comparing different EEG cleaning algorithms (see this blog post), I was looking for a valid and trustworthy Python implementation of the original algorithm for Artifact Subspace Reconstruction.

Artifact Subspace Reconstruction is a promising EEG cleaning algorithm, which is gaining more and more popularity due to its convincing cleaning results. It was originally developed for an EEGLAB extension in MATLAB, but there was no perfectly equivalent version in Python. Following preceding work done by Nicholas Barascud, and the original implementation by Christian Kothe and Scott Makeig, I started to create a Python version of Artifact Subspace Reconstruction that would be perfectly equivalent with the original MATLAB implementation. After a lot of work and comparisons I succeded in doing so, producing an Artifact Subspace Reconstruction which was only differing from the MATLAB version by external factors, such as slightly differing Eigenspace solver algorithms used in numpy and MATLAB. However, all other operations were perfectly replicating the MATLAB code.

The result can be found in my ASRpy repository. Information on the algorithm, installation and examples can be found there.

IF you want to know how to apply ASRpy to your own Python EEG data (either with MNE-Python or with numpy arrays), you can go through this tutorial: