Tensor-based Phase-Amplitude Coupling
Project description
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, 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()
Contributors
Juan L.P. Soto
Timothy C. Nest
Project details
Release history Release notifications | RSS feed
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.1.tar.gz
(27.8 kB
view hashes)
Built Distribution
tensorpac-0.6.1-py3-none-any.whl
(32.2 kB
view hashes)
Close
Hashes for tensorpac-0.6.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ed863aab43bd71c170345ab096e79da954926a4e2e23b4a892e5b4b9d9b9f6f |
|
MD5 | 86231cf018ff9e8ed02a944bee0615a6 |
|
BLAKE2b-256 | 788537d72aecfbb673fdb36b5020dc05aa06e6cb36e90a949db4af185d52f73e |