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

Uploaded CPython 3.10Windows x86-64

natmeeg-1.6.4-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.4-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.4.tar.gz.

File metadata

  • Download URL: natmeeg-1.6.4.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.4.tar.gz
Algorithm Hash digest
SHA256 73d5ae9c3d1f1bcac4f3f85c38653509bf5960ea3b5e9cae30bf5a33e458d8a8
MD5 61672cd0155fa509a3158ebefb20986b
BLAKE2b-256 4ab9c61bc08901e185231e06c37eead452648faa109867ceac8a4eb111a07930

See more details on using hashes here.

File details

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

File metadata

  • Download URL: natmeeg-1.6.4-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.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1d0d8967e65d41299a20164c2fc205f3877260053d5224b1b6e9ef5a7734cf0c
MD5 5f6d3c51f5f1847df1c348ea37b1293b
BLAKE2b-256 e390780dfd0d47ee014c7e2f9f50164c1eb785744e2fa939fa92b040fba25ab7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for natmeeg-1.6.4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 530e2442d025cf43b4e98462f520e75c0bdd05bb3e14f7663d0e059273a451f2
MD5 fb97f05507b3d6b1ccdfa7af61efd572
BLAKE2b-256 efd393e6436dd0d9b209fdcf77f521b027432865120d5677ea49a07b75ff108a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for natmeeg-1.6.4-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 2fbcd5f8f2b23ce9979049363bb4c43b08ec9bfff306a280b1125f2eac2cf247
MD5 573edb4a48d99e3fa8dce37deaf36aef
BLAKE2b-256 47053cd9afcd96fe305bf0fa06e330cfa73dc33e223c8ff5ef0f05ee6fd2b410

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