Skip to main content

GPU-Accelerated Phase-Amplitude Coupling calculation using PyTorch

Project description

gPAC: GPU-Accelerated Phase-Amplitude Coupling

gPAC is a PyTorch-based package for efficient computation of Phase-Amplitude Coupling (PAC) metrics with GPU acceleration.

Key Features

  • GPU Acceleration: 5-100x faster PAC computation via PyTorch/CUDA
  • Differentiable Filters: Optional gradient flow for integration with deep learning models
  • Synthetic Data Generation: Built-in tools for generating test signals with known PAC properties
  • Statistical Analysis: Permutation testing and surrogate distributions for validation
  • Return Full Distributions: Access complete surrogate data for custom statistical analyses

Quick Start

# Installation
git clone https://github.com/[username]/gPAC.git
cd gPAC
pip install -e .
# Basic usage
import torch
import gpac
import numpy as np

# Create example data (batch_size, channels, segments, time)
signal = torch.randn(2, 4, 1, 1024)

# Calculate PAC with GPU acceleration
pac_values, pha_freqs, amp_freqs = gpac.calculate_pac(
    signal=signal,
    fs=256.0,         # Sampling frequency
    pha_n_bands=10,   # Number of phase bands
    amp_n_bands=10,   # Number of amplitude bands
    device="cuda",    # Use GPU
    n_perm=200,       # Permutation testing
)

Documentation

For detailed usage examples and API reference, see:

  • examples/ directory for sample scripts
  • src/gpac/README.md for implementation details
  • Docstrings in the source code for function parameters

Contact

Yusuke Watanabe (ywatanabe@alumni.u-tokyo.ac.jp)

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

torch_pac-0.1.0.tar.gz (34.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

torch_pac-0.1.0-py3-none-any.whl (45.3 kB view details)

Uploaded Python 3

File details

Details for the file torch_pac-0.1.0.tar.gz.

File metadata

  • Download URL: torch_pac-0.1.0.tar.gz
  • Upload date:
  • Size: 34.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.4

File hashes

Hashes for torch_pac-0.1.0.tar.gz
Algorithm Hash digest
SHA256 832f03f0c11aeb025fb7a11218dcc2a87132df215c9eee483972f0ad22419eff
MD5 3e5c2b0835eac57dde28e9fbf6a3842e
BLAKE2b-256 269c1e639899bbc83027f237419a54ead3b148a4f76c9b7d0731ff121c3ad47e

See more details on using hashes here.

File details

Details for the file torch_pac-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: torch_pac-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 45.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.4

File hashes

Hashes for torch_pac-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2ac8db11ef665e8402d1d950bd01e9736aab451c5b7d1d73666a7c320a29370e
MD5 dceedf35f7a8d067e1fdb6577ec137dc
BLAKE2b-256 b9d8f7a9ba8aa28345aaff8afc2ffa37711447221ee79de4f4a0be15cc925afc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page