PyPrep Preprocessing Pipeline for EEG

01 May 2018

PyPrep is my attempt at translating the “PREP” (PREprocessing Pipeline) for EEG data into Python. The original implementation is only available in Matlab and intended for cleaning raw EEG data as a first standardized step before working with it.

Out of all functionalities that PREP offers, I particularly liked the “findNoisyChannels” function. With it, the EEG data are subjected to several robust tests to tease out channels that contain noise:

  1. Contains n/a values or is flat over an extended period?
  2. Abnormal deviations of amplitude i.e., too much or too little?
  3. Low correlation with other channels?
  4. Not well predicted by other channels? (yes, this is different from 3. see the code)

As mentioned before, with PyPrep there is now a Python implementation of this function, which works closely with MNE-Python, the arguably most popular software package for EEG analysis in Python.

As of May 2018, the “findNoisyChannels” function is the only part of the PREP that I implemented in Python (contributions welcome!) however, there is one more thing:

The original PREP does not implement a robust screening of noisy epochs; so I implemented another function borrowed from FASTER, which is yet another preprocessing pipeline for EEG data (they really like their acronyms).

In conclusion, PyPrep currently offers two convenient functions for automatically cleaning your EEG data in a conservative and robust way.

The code is available on github and pypi.

Creative Commons Licence Except where otherwise noted, the content of this post is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License .