Skip to content

Calculate phase-amplitude coupling in Python (and Matlab).

License

Notifications You must be signed in to change notification settings

dengemann/pacpy

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pacpy

Build Status

A (work in progress) module to calculate phase-amplitude coupling in Python.

This code is ALMOST ready for general use.

Install

Not yet uploaded to pypi (...soon). To install:

  1. git clone https://github.com/voytekresearch/pacpy into the directory of your choice.
  2. At the command line, cd into that choice directory
  3. and type pip install .

We assume Anaconda is installed. Tested on Linux (Ubuntu 4.10), OS X (10.10.4), and Windows 9.

Matlab

The wrapper for MATLAB can be found at, https://github.com/voytekresearch/pacmat

Usage

An example of calculating PAC from two simulated voltage signals using the phase-locking value (PLV) method:

    >>> import numpy as np
	>>> from scipy.signal import hilbert
	>>> from pacpy.pac import plv
	>>> t = np.arange(0, 10, .001) # Define time array
	>>> lo = np.sin(t * 2 * np.pi * 6) # Create low frequency carrier
	>>> hi = np.sin(t * 2 * np.pi * 100) # Create modulated oscillation
	>>> hi[np.angle(hilbert(lo)) > -np.pi*.5] = 0 # Clip to 1/4 of cycle
	>>> plv(lo, hi, (4,8), (80,150)) # Calculate PAC
	0.998263840824846

About

Calculate phase-amplitude coupling in Python (and Matlab).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%