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
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()
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.5.tar.gz
(388.1 kB
view details)
Built Distribution
tensorpac-0.6.5-py3-none-any.whl
(423.6 kB
view details)
File details
Details for the file tensorpac-0.6.5.tar.gz
.
File metadata
- Download URL: tensorpac-0.6.5.tar.gz
- Upload date:
- Size: 388.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0.post20200712 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a23511f13a38464a428504f890377b8664145b7c094dd5faa0adeb1fddfde248 |
|
MD5 | c8ecf5c4bcbebf2cf877ae0b33dbc650 |
|
BLAKE2b-256 | 344cb7cab0522f4e9601a7e44d14d250801267d20848498426da875f53896bab |
File details
Details for the file tensorpac-0.6.5-py3-none-any.whl
.
File metadata
- Download URL: tensorpac-0.6.5-py3-none-any.whl
- Upload date:
- Size: 423.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0.post20200712 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 579d65a0ba85400886dcf4074d5704d334ec9543bcf2d8cd2a6d9f63f37e57d0 |
|
MD5 | 3789930d4648f4caa7636c3614c932c5 |
|
BLAKE2b-256 | 4a748818a87c860f24dff6f22032cf3a6464d9aa7875db474fa676df0d919682 |