Skip to main content

A library to process M/EEG data with a set of utility functions with a framework focused on continuous recordings and naturalistic stimuli.

Project description

pyEEG

PyPI version

v1.5.1 (2025-04-14)

pyEEG is a library for processing EEG data built mostly on top of MNE-py and scikit-learn. It is framed to work with data collected with naturalistic stimuli, therefore with continuous recordings rather than trial-based designs. It allows analysis of continuous m/eeg and generation of temporal response functions with continuous signals as stimuli or real-valued events (e.g. word-level or phoneme-level features).

You can find the documentation here.

Note that this code repository is relatively old and unmaintained. Most useful code about computing TRF is contained in pyeeg/models.py, especially in the class TRFEstimator and the function _svd_regress: the latter implements TRF estimation with memory efficient and accelerated computation for handling multiple epochs or multiple subjects.


Installation

Dependencies

pyEEG requires:

  • Python (>= 3.10)
  • psutil
  • tqdm
  • NumPy
  • SciPy
  • scikit-learn
  • matplotlib
  • h5py
  • pandas
  • mne (>= 0.16) [optional]

Install requirements:

pip install -r requirements.txt

To generate the doc, Python package sphinx (>= 1.1.0), sphinx_rtd_theme and nbsphinx are required (sphinx can be installed from conda and the others from pip).

User Installation

From PyPI

You can install the package from PyPI using pip:

pip install pyEEG

From Source

From terminal (or conda shell in Windows), cd in root directory of the library (directory containing setup.py file) and type:

To get the package installed only through symbolic links, namely so that you can modify the source code and use modified versions at will when importing the package in your python scripts do:

pip install -e .

Otherwise, for a standard installation (but this will require to be installed if you need to install another version of the library):

pip install .

Windows Users

There are C-extensions in the library, so you need to have a C compiler installed on your machine. If the default compiler does not work, you can try to install Visual Studio Build Tools and try again.

Optionally try with MinGW, making sure after instalation of it to add the path to mingw/bin in your PATH environment variable. You can check if it is correctly installed by running the following command in your terminal:

gcc --version

Then you can run:

pip install . --global-option=build_ext --global-option=--compiler=mingw32

Basic Examples

See files in examples/.

Computing Envelope TRF and spatial map from CCA

See examples/CCA_envelope.ipynb

Computing Word-feature TRF

See examples/TRF_wordonsets.ipynb

Working with Word vectors

See examples/import_WordVectors.ipynb

Documentation

You can generate an offline HTML version, or a PDF file of all the docs by following the following instructions (HTML pages are easier to navigate in and prettier than the PDF thanks to the nice theme brought by sphinx_rtd_theme).

Generate the documentation

To generate the documentation you will need sphinx to be installed in your Python environment, as well as the extension nbsphinx (for Jupyter Notebook integration) and the theme package sphinx_rtd_theme. Install those with:

conda install sphinx
conda install -c conda-forge nbsphinx
pip install sphinx_rtd_theme

You can access the doc as HTML or PDF format. To generate the documentation HTML pages, type in a terminal:

For Unix environment (from root directory):

make doc

For Windows environment (from docs folder):

cd docs
make.bat html

Then you can open the docs/build/html/index.html page in your favourite browser.

And for PDF version, simply use docpdf instead of doc above. Then open docs/build/latex/pyEEG.pdf in a PDF viewer.

Note: The PDF documentation can only be generated if latex and latxmk are present on the machine

To clean files created during build process (can be necessary to re-build the documentation):

make clean

TODOs

  • Use doctest for systematic testing of some functions
  • Functional connectivity methods:
    • Estimate connectivity (in construction)
    • Graph theory metrics (path length, clustering coeff.)
  • Pipeline pyRiemann and pyeeg this one into some workflows..

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

natmeeg-1.6.0.tar.gz (6.6 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

natmeeg-1.6.0-cp310-cp310-win_amd64.whl (26.8 kB view details)

Uploaded CPython 3.10Windows x86-64

natmeeg-1.6.0-cp310-cp310-macosx_10_9_universal2.whl (27.4 kB view details)

Uploaded CPython 3.10macOS 10.9+ universal2 (ARM64, x86-64)

File details

Details for the file natmeeg-1.6.0.tar.gz.

File metadata

  • Download URL: natmeeg-1.6.0.tar.gz
  • Upload date:
  • Size: 6.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for natmeeg-1.6.0.tar.gz
Algorithm Hash digest
SHA256 9c1a6c81d88eefadeb295a78a1ebc53c0df6493bf6bd949bfe8294a89d97f351
MD5 143bff66bceb8e5df3cec7498402c053
BLAKE2b-256 1ff723f48c9e0fbc0fbbb347bdaea2aef496fbc5aa67e8635cb8ff3e96c97285

See more details on using hashes here.

File details

Details for the file natmeeg-1.6.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: natmeeg-1.6.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 26.8 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for natmeeg-1.6.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 15e3668d0d87e8a85ea20642f1dee21531ec46f917f8839d8536a8ebede84136
MD5 e97c44b5a59b27648472e30f7e7b2a9b
BLAKE2b-256 8b7cb564ea66ab04621d9ff337eecb0d3d361afa42ea1a3abd9c0f32ff8c30c3

See more details on using hashes here.

File details

Details for the file natmeeg-1.6.0-cp310-cp310-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for natmeeg-1.6.0-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 0043514f01bae630b3234433f7f2e1d05d5f868beb5f01cf88d7e817c8774455
MD5 b0b894da4cf1d47ba63e7a2662384e20
BLAKE2b-256 a836b9f6d205c79a3108d6456002c8dbd3bf401d4fd251867496b813fab2507c

See more details on using hashes here.

Supported by

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