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.

http://autoreject.github.io/_images/sphx_glr_plot_visualize_bad_epochs_002.png

The documentation can be found under the following links:

Installation

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

  • h5py (for writing autoreject objects using the HDF5 format)

  • openneuro-py (>= 2021.7, 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. 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.3.tar.gz (45.2 kB view details)

Uploaded Source

Built Distribution

autoreject-0.3-py3-none-any.whl (27.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: autoreject-0.3.tar.gz
  • Upload date:
  • Size: 45.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.7.4

File hashes

Hashes for autoreject-0.3.tar.gz
Algorithm Hash digest
SHA256 26e7e17fa57b78bad23d6e5a1b6eb8a4558fb6cb331953605f1ad9d7b085d3f5
MD5 a9406e7b86042f6cd3309082b583d6fa
BLAKE2b-256 d280164cf0b99427588a4c91e09e8cd3545eed32cc17b3d97017a4b7b00368f5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: autoreject-0.3-py3-none-any.whl
  • Upload date:
  • Size: 27.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.7.4

File hashes

Hashes for autoreject-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a5410e73beb5e72dccf87ca8d808690e6976a4565009bb2d532ed1bf6356f403
MD5 bbefc6c69e95c2ebd6d2075fd27741e4
BLAKE2b-256 30409eeb34e71546b76cdfc621283fa2e5a353213aab5a79b15eee9684df9d4d

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