Skip to main content

Automated rejection and repair of epochs in M/EEG.

Project description

autoreject

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.

https://autoreject.github.io/stable/_images/sphx_glr_plot_auto_repair_001.png

The documentation can be found under the following links:

Installation

We recommend the Anaconda Python distribution and a Python version >= 3.8. 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 https://api.github.com/repos/autoreject/autoreject/zipball/master

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 (>=1.0)

  • numpy (>=1.20.2)

  • scipy (>=1.6.3)

  • scikit-learn (>=0.24.2)

  • joblib

  • matplotlib (>=3.4.0)

Optional dependencies are:

  • openneuro-py (>= 2021.10.1, for fetching data from OpenNeuro.org)

Quickstart

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 (see PyPREP for a full implementation of 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.

Cite

[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.4.2.tar.gz (46.6 kB view details)

Uploaded Source

Built Distribution

autoreject-0.4.2-py3-none-any.whl (29.8 kB view details)

Uploaded Python 3

File details

Details for the file autoreject-0.4.2.tar.gz.

File metadata

  • Download URL: autoreject-0.4.2.tar.gz
  • Upload date:
  • Size: 46.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.16

File hashes

Hashes for autoreject-0.4.2.tar.gz
Algorithm Hash digest
SHA256 3984d328bbc26485b4abae61f91b786f457a3a1dcea92b162fc9b29b1b1e2713
MD5 388d25d85c4e9da40a61845d9958bd35
BLAKE2b-256 bde69dc9b07f4a0d601901261a26ea74c8349a0cd15cac90a18a2b56aa102e28

See more details on using hashes here.

File details

Details for the file autoreject-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: autoreject-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 29.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.16

File hashes

Hashes for autoreject-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0a71ce576e550bb1683eee495de8cad12b989ce4d37da4f6856ba1c0d9d3d820
MD5 2436ba321b416ba45bcd09978b9f7efd
BLAKE2b-256 ec33d7231b0081afd732075d94a3bc2ef4e4ced129e048ab069d2f1c9f54fb48

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page