This is a library to automatically reject bad trials and repair bad sensors in magneto-/electroencephalography (M/EEG) data.
We recommend the Anaconda Python distribution. To install
autoreject, you first need to install its dependencies:
$ pip install numpy matplotlib scipy mne scikit-learn
An optional dependency is tqdm if you want to use the verbosity flags ‘tqdm’ or ‘tqdm_notebook’ for nice progressbars.
Then install autoreject:
$ pip install git+https://github.com/autoreject/autoreject.git#egg=autoreject
If you do not have admin privileges on the computer, use the
with pip. To upgrade, use the
--upgrade flag provided by pip.
To check if everything worked fine, you can do:
$ python -c 'import autoreject'
and it should not give any error messages.
The easiest way to get started is to copy the following three lines of code in your script:
>>> from autoreject import LocalAutoRejectCV >>> ar = LocalAutoRejectCV() >>> epochs_clean = ar.fit_transform(epochs)
This will automatically clean an epochs object read in using MNE-Python. To get the rejection dictionary, simply do:
>>> from autoreject import get_rejection_thresholds >>> reject = get_rejection_thresholds(epochs)
We also implement RANSAC from the PREP pipeline. The API is the same:
>>> from autoreject import Ransac >>> rsc = Ransac() >>> epochs_clean = rsc.fit_transform(epochs)
For more details check out the example to automatically detect and repair bad epochs.
Fow now, we do not guarantee if autoreject (local) will work for more than one channel type. We intend to support multiple channel types, but in the future. Contributions to make this happen are welcome.
 Mainak Jas, Denis Engemann, Federico Raimondo, Yousra Bekhti, and Alexandre Gramfort, “Automated rejection and repair of bad trials in MEG/EEG.” In 6th International Workshop on Pattern Recognition in Neuroimaging (PRNI), 2016.
 Mainak Jas, Denis Engemann, Yousra Bekhti, Federico Raimondo, and Alexandre Gramfort, “Autoreject: Automated artifact rejection for MEG and EEG.” arXiv preprint arXiv:1612.08194, 2016.