Skip to main content

Tensor-based Phase-Amplitude Coupling

Project description

https://travis-ci.org/EtienneCmb/tensorpac.svg?branch=master https://codecov.io/gh/EtienneCmb/tensorpac/branch/master/graph/badge.svg https://badge.fury.io/py/tensorpac.svg https://pepy.tech/badge/tensorpac https://badges.gitter.im/EtienneCmb/tensorpac.svg
https://github.com/EtienneCmb/tensorpac/blob/master/docs/source/picture/tp.png

Description

Tensorpac is an Python open-source toolbox for computing Phase-Amplitude Coupling (PAC) using tensors and parallel computing for an efficient, and highly flexible modular implementation of PAC metrics both known and novel. Check out our documentation for details.

Installation

Tensorpac uses NumPy, SciPy and joblib for parallel computing. To get started, just open your terminal and run :

$ pip install tensorpac

Code snippet & illustration

from tensorpac import Pac
from tensorpac.signals import pac_signals_tort

# Dataset of signals artificially coupled between 10hz and 100hz :
n_epochs = 20
n_times = 4000
sf = 512.  # sampling frequency

# Create artificially coupled signals using Tort method :
data, time = pac_signals_tort(f_pha=10, f_amp=100, noise=2, n_epochs=n_epochs,
                              dpha=10, damp=10, sf=sf, n_times=n_times)

# Define a PAC object :
p = Pac(idpac=(6, 3, 0), f_pha=(2, 20, 1, 1), f_amp=(60, 150, 5, 5))
# Filter the data and extract PAC :
xpac = p.filterfit(sf, data, n_perm=20)

# Plot your Phase-Amplitude Coupling :
p.comodulogram(xpac.mean(-1), title='Contour plot with 5 regions',
               cmap='Spectral_r', plotas='contour', ncontours=5)

p.show()
https://github.com/EtienneCmb/tensorpac/blob/master/docs/source/picture/readme.png

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

tensorpac-0.6.3.tar.gz (91.7 kB view details)

Uploaded Source

Built Distribution

tensorpac-0.6.3-py3-none-any.whl (116.8 kB view details)

Uploaded Python 3

File details

Details for the file tensorpac-0.6.3.tar.gz.

File metadata

  • Download URL: tensorpac-0.6.3.tar.gz
  • Upload date:
  • Size: 91.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for tensorpac-0.6.3.tar.gz
Algorithm Hash digest
SHA256 11278f5beecfd6dfd87d76338ba9ad9f5e951332d115855283f10a4f56c39e98
MD5 07cf7d75f439bdbd8b3f74e2d2a4ad8e
BLAKE2b-256 fa352c7069145b94c932d3861f392b031d1809b3aa9ea66a3a4f89afba5b9ee6

See more details on using hashes here.

File details

Details for the file tensorpac-0.6.3-py3-none-any.whl.

File metadata

  • Download URL: tensorpac-0.6.3-py3-none-any.whl
  • Upload date:
  • Size: 116.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for tensorpac-0.6.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c39ff04c7987694a0fdfe4c0b24c688f4607495ff4a755e617f0a71981179abf
MD5 3aa6daeed15ff026b6d62a5075ccd57f
BLAKE2b-256 2c3a4f471b2a739f97f3f9f97b1c78642adf9a632fd6bedee1d055a4c6a164d2

See more details on using hashes here.

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