Tensor-based Phase-Amplitude Coupling
Project description
Tensorpac
Description
Tensorpac is an Python open-source toolbox for computing Phase-Amplitude Coupling (PAC) using tensors and parallel computing. On top of that, we designed a modular implementation with a relatively large amount of parameters. Checkout the documentation for further details.
Installation
Tensorpac use NumPy, SciPy and joblib for parallel computing. In a terminal, run :
pip install tensorpac
Code snippet & illustration
import matplotlib.pyplot as plt
from tensorpac.utils import pac_signals
from tensorpac import Pac
# Dataset of signals artificially coupled between 10hz and 100hz :
n = 100 # number of datasets
data, time = pac_signals(fpha=10, famp=100, noise=3, ndatasets=n, dpha=10, damp=10)
# Extract PAC :
p = Pac(idpac=(4, 0, 0), fpha=(2, 30, 1, 1), famp=(60, 150, 5, 5),
dcomplex='wavelet', width=12)
xpac, pval = p.filterfit(1024, data, data, axis=1, nperm=100)
# Plot your Phase-Amplitude Coupling :
p.comodulogram(xpac.mean(-1), title='Contour plot with 5 regions',
cmap='Spectral_r', plotas='contour', ncontours=5, vmin=60, vmax=300)
plt.show()
Contributors
Juan L.P. Soto
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.5.3.tar.gz
(22.5 kB
view details)
File details
Details for the file Tensorpac-0.5.3.tar.gz
.
File metadata
- Download URL: Tensorpac-0.5.3.tar.gz
- Upload date:
- Size: 22.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e242688d697ca768201446302a00f9a6f6be576ccde4539bed430bf53d5cff9 |
|
MD5 | 98cd79cf4cf648b78270e6ae0f77adf7 |
|
BLAKE2b-256 | 2b9fa0df5ed326234a18c18145d7a3280ef0233e836f35abafa8333d55c68489 |