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

natMEEG - Naturalistic M/EEG data analysis

PyPI version

v1.5.1 (2025-04-14)

Formerly named pyEEG

natMEEG is a library for processing M/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.

⚠️Caution:

  • 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.
  • It is recommended to use the code as a reference for your own implementation rather than relying on it for production use.
  • Finaly note that the repository went through a name change from pyEEG to natMEEG, so you might find references to pyEEG in the code and documentation.

Installation

Dependencies

natMEEG 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.

User Installation

From PyPI

You can install the package from PyPI using pip:

pip install natMEEG

If you want to install docs building dependencies, you can do:

pip install natMEEG[docs]

If you want to install the package with all dependencies (including MNE), you can do:

pip install natMEEG[full]

From Source

From terminal, cd in root directory of the library after cloning this repository (directory containing pyproject.toml file).

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

Or set the environment variable DISTUTILS_USE_SDK=1 and MSSdk=1 before running the command.

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

License

This project is licensed under the terms of the GPL-3.0 license. See the LICENSE file for details.

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.5.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.5-cp310-cp310-win_amd64.whl (26.9 kB view details)

Uploaded CPython 3.10Windows x86-64

natmeeg-1.6.5-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl (44.5 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.5+ x86-64

natmeeg-1.6.5-cp310-cp310-macosx_10_9_universal2.whl (27.6 kB view details)

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

File details

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

File metadata

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

File hashes

Hashes for natmeeg-1.6.5.tar.gz
Algorithm Hash digest
SHA256 95b35269a1dd1f98fd9a56bf31e87392d07ce0a61ea0174528a7c02ccb736ff5
MD5 12a4685a782c5ac5ed0661c3b82e8fe5
BLAKE2b-256 6ae038abb30cfa8de5d5fe287d30d4ae403edf31f24f95b2fe23cc1c945efb03

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for natmeeg-1.6.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5a658fae38eea27f43df8e36544b0ec3c16df9e5720dd9353b3cdb1393d1c8e5
MD5 a80fff4a984418c066c9c0177a1ddb96
BLAKE2b-256 6df4e17888e0c074eb749a6bb9784b41ff3067da44516e587526825f7bf0f10e

See more details on using hashes here.

File details

Details for the file natmeeg-1.6.5-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for natmeeg-1.6.5-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 08e618a5242904a94db78a0ed6e3cbc93e5b67c95154455b3520394edd912158
MD5 82eac98d0a5f9e6080faa721c3d1000a
BLAKE2b-256 8fad3796d370b0c9dcb9a8a99626d2596f5b16bc1ee28e29fc78a60abca15efb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for natmeeg-1.6.5-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 6927eac9ab6649df0b4ca3ca3f428d4929c2f550a566611441e6f5bb692e7bd2
MD5 2654e06dc740625750d3b6849885124f
BLAKE2b-256 5ab108b9f93174a7c64094ce801f3d99d187861557608136cb974bfd366a8f4a

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