Skip to main content

Tensor-based Phase-Amplitude Coupling

Project description

https://github.com/EtienneCmb/tensorpac/workflows/Tensorpac/badge.svg https://travis-ci.org/EtienneCmb/tensorpac.svg?branch=master https://circleci.com/gh/EtienneCmb/tensorpac/tree/master.svg?style=svg https://ci.appveyor.com/api/projects/status/0arxtw05583gc3e2/branch/master?svg=true 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   # number of trials
n_times = 4000  # number of time points
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, 0, 0), f_pha='hres', f_amp='hres')
# Filter the data and extract pac
xpac = p.filterfit(sf, data)

# plot your Phase-Amplitude Coupling :
p.comodulogram(xpac.mean(-1), cmap='Spectral_r', plotas='contour', ncontours=5,
               title=r'10hz phase$\Leftrightarrow$100Hz amplitude coupling',
               fz_title=14, fz_labels=13)

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.5.tar.gz (388.1 kB view hashes)

Uploaded Source

Built Distribution

tensorpac-0.6.5-py3-none-any.whl (423.6 kB view hashes)

Uploaded Python 3

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