Skip to main content

Automated rejection and repair of epochs in M/EEG.

Project description


CircleCI GitHub Actions Codecov PyPI Conda-Forge

This is a library to automatically reject bad trials and repair bad sensors in magneto-/electroencephalography (M/EEG) data.

The documentation can be found under the following links:


We recommend the Anaconda Python distribution and a Python version >= 3.7. To obtain the stable release of autoreject, you can use pip:

pip install -U autoreject

Or conda:

conda install -c conda-forge autoreject

If you want the latest (development) version of autoreject, use:

pip install

If you do not have admin privileges on the computer, use the --user flag with pip.

To check if everything worked fine, you can do:

python -c 'import autoreject'

and it should not give any error messages.

Below, we list the dependencies for autoreject. All required dependencies are installed automatically when you install autoreject.

  • mne (>=0.24)
  • numpy (>=1.20)
  • scipy (>=1.6)
  • scikit-learn (>=0.24)
  • joblib
  • matplotlib (>=3.3)

Optional dependencies are:

  • tqdm (for nice progress-bars when setting verbose=True)
  • h5io (for writing autoreject objects using the HDF5 format)
  • openneuro-py (>= 2021.7, for fetching data from


The easiest way to get started is to copy the following three lines of code in your script:

>>> from autoreject import AutoReject
>>> ar = AutoReject()
>>> epochs_clean = ar.fit_transform(epochs)  # doctest: +SKIP

This will automatically clean an epochs object read in using MNE-Python. To get the rejection dictionary, simply do:

>>> from autoreject import get_rejection_threshold
>>> reject = get_rejection_threshold(epochs)  # doctest: +SKIP

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)  # doctest: +SKIP

For more details check out the example to automatically detect and repair bad epochs.

Bug reports

Please use the GitHub issue tracker to report bugs.


[1] 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.

[2] Mainak Jas, Denis Engemann, Yousra Bekhti, Federico Raimondo, and Alexandre Gramfort. 2017. “Autoreject: Automated artifact rejection for MEG and EEG data”. NeuroImage, 159, 417-429.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autoreject-0.3.1.tar.gz (42.3 kB view hashes)

Uploaded source

Built Distribution

autoreject-0.3.1-py3-none-any.whl (27.3 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page