Skip to content

melissafasol/ArtifactDetection

Repository files navigation

ArtifactDetection: EEG Artifact Identification with the Spectral Slope

Quick installation from PyPI:

pip install ArtifactDetection==0.0.1

After installation, import as:

import artifactdetection as ad

Overview

Analyzing EEG signals often involves looking at power spectra to identify dominant frequency bands, which is useful for sleep studies. However, noise can contaminate these recordings and increase overall power.

  • ArtifactDetection removes these artifacts using the spectral slope method, which involves linear regression of the logarithmic EEG power spectra. This method, previously used to distinguish conscious states, can also identify epochs contaminated by noise.

  • Unlike other EEG preprocessing methods that need multiple electrodes and advanced signal processing knowledge, ArtifactDetection requires no prior knowledge and can remove artifacts in a few lines of code!

  • The plots below illustrate the power spectra before and after ArtifactDetection. In the 'Before' plot, the y-axis reveals inflated power levels for all animals. After cleaning, these levels are reduced, allowing clear spectral trends to emerge.

Before After
Before After

Notebooks

The following notebooks show you how to implement ArtifactDetection:

  1. Preprocessing: formatting data correctly

Power analysis requires that EEG recording files are in .npy format and corresponding brain state files are in .pkl format. If your files are already in that format, you can skip the preprocessing step.

  1. Power: run power analysis

This notebook shows how to run the power analysis, it requires several inputs to run which are detailed at the top of the notebook (folder path, start and end dictionaries, channel index, etc.)

  1. Analyse: threshold and plot

Notebook showing analysis of power calculations, including separating data by a slope threshold into clean and noisy epochs.

Citation

If you use ArtifactDetection in your work, please cite it as follows:

@inproceedings{fasol2023single,
  title={Single-Channel EEG Artifact Identification with the Spectral Slope},
  author={Fasol, Melissa CM and Escudero, Javier and Gonzalez-Sulser, Alfredo},
  booktitle={2023 IEEE International Conference on Bioinformatics and Biomedicine (BIBM)},
  pages={2482--2487},
  year={2023},
  organization={IEEE}
}

License

ArtifactDetection has a MIT license, as found in the LICENSE file.

About

Method to remove artifacts from EEG data using the spectral slope.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published