Skip to main content

Analyze and manipulate EEG data using PyEEGLab

Project description

PyEEGLab

DOI Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. Build Status Documentation Status codecov Maintainability CodeFactor Gitpod Ready-to-Code

Analyze and manipulate EEG data using PyEEGLab.

Introduction

PyEEGLab is a python package developed to define pipeline for EEG preprocessing for a wide range of machine learning tasks. It supports set of datasets out-of-the-box and allow you to adapt your preferred one.

How it Works

Here is a simple quickstart:

from pyeeglab import *
dataset = TUHEEGAbnormalDataset()
pipeline = Pipeline([
    CommonChannelSet(),
    LowestFrequency(),
    ToDataframe(),
    MinMaxCentralizedNormalization(),
    DynamicWindow(8),
    ToNumpy()
])
dataset = dataset.set_pipeline(preprocessing).load()
data, labels = dataset['data'], dataset['labels']

In this example, for each sample in the dataset, a common set of electrodes is selected, then downsampled to the lowest frequency and normalized using a min-max centralized approach. Each sample is then splitted in eight windows or frames.

This approach is quite usefull for tasks like artifact classification or seizure detection.

How to Install

PyEEGLab is distributed using the pip repository:

pip install PyEEGLab

If you use Python 3.6, the dataclasses package must be installed as backport of Python 3.7 dataclasses:

pip install dataclasses

If you need a bleeding edge version, you can install it directly from GitHub:

pip install git+https://github.com/AlessioZanga/PyEEGLab@develop

Out-Of-The-Box Supported Datasets

The following datasets will work upon downloading:

How to Get a Dataset

WARNING (1): Retriving the TUH EEG Abnormal dataset require at least 65GB of free disk space.

WARNING (2): Retriving the TUH EEG Abnormal dataset require valid credentials, you can get your own at https://www.isip.piconepress.com/projects/tuh_eeg/html/request_access.php.

In the root directory of this project there is a Makefile, by typing:

make tuh_eeg_abnormal

you will trigger the dataset download.

Documentation

WIP: Documentation is currently Work-In-Progress, if you need additional info, please, contact me directly.

You can find the documentation at https://pyeeglab.readthedocs.io

Credits

If you use this code in your project use the citation below:

@misc{Zanga2019PyEEGLab,
    title={PyEEGLab: A simple tool for EEG manipulation},
    author={Alessio Zanga},
    year={2019},
    doi={10.5281/zenodo.3874461},
    url={https://dx.doi.org/10.5281/zenodo.3874461},
    howpublished={\url{https://github.com/AlessioZanga/PyEEGLab}},
}

Related publications

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

PyEEGLab-0.9.3.tar.gz (15.4 kB view hashes)

Uploaded Source

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