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

Tensorpac

Tensorpac is an open-source Python toolbox for computing Phase-Amplitude Coupling (PAC) using tensors and parallel computing. This software provides a modular implementation which allows one to combine existing methods for measuring PAC and chance distribution.

_images/tp.png

Tensor based implementation

In general, most of the softwares implemented the PAC in a vectorial fashion. This means that the PAC is computed between a single vector of phase and a single vector of amplitude. One of the limitation of this approach is that it can be relatively slow when exploring multi-dimensional data (e.g number of electrodes / sensors, number of trials, several frequency bands etc.). Tensorpac uses a different approach, using the Einstein summation, where the PAC is implemented in order to support multi-dimensional arrays (i.e tensors). This type of implementation can drastically decrease computational cost, especially if it’s combined with parallel computing as it is the case in Tensorpac.

_images/10_detailed_loop_vs_tensor.png

On the left, a traditional loop implementation to compute PAC between vectors. On the right, an illustration of the tensor-based implementation.