Git Product home page Git Product logo

phase-coherence-for-python's Introduction

Phase-Coherence-for-Python

Function to calculate consistency of phase at a given frequency across measurements

About the method

Some background

This function calculates phase coherence at a frequency of interest, across different measurements. The phase coherence value indexes how consistent the phase is across different measurements. The phase coherence value lies between 0 and 1: 1 indicates perfect phase coherence and 0 indicates no phase coherence.

This method is often used in electro-encephalography (EEG) analyses to determine the phase consistency of the neural response at a particular frequency, across trials. For example, researchers often choose to investigate phase consistency at the frequency of a presented stimulus. Note that the same method is sometimes referred to as the phase locking value (PLV)--although some implementations of the PLV use a time-series filter rather than conducting the analyses in the frequency domain, as used here.

The method is described in the following paper:

Picton, T. W., John, M. S., Dimitrijevic, A., & Purcell, D. (2003). Human auditory steady-state responses: Respuestas auditivas de estado estable en humanos. International journal of audiology, 42(4), 177-219.

Extentions of the method

This method could be applied to examine patterns in time-series data other than neural data.

Getting started

Prerequisites

The code was written using using Python 3.6.1. The code requires numpy.

Running the Python script

The Python code is contained within the following file: PhaseCoherence.py

The script takes three inputs:

  1. freq - this is a floating point value indicating the frequency to be analysed, in Hertz, e.g. 50.
  2. timeSeries - this is the data to be analysed; should be a 2-dimensional matrix of size: (number of trials/measurements) x (number of time points)
  3. FS - this is the sampling rate of the time-series data, in Hertz, e.g. 1000.

The code can be run as follows:

PC = PhaseCoherence(freq, timeSeries, FS)

The output from the script is a floating-point value between 0 and 1.

Note for MATLAB users

There are two versions of the code, which perform the same computations and output: one for MATLAB and one for Python 3. The MATLAB code can be found in a separate repository: Phase-Coherence-for-MATLAB

License

This project is licensed under the MIT License; see the LICENSE file for details.

This project can be cited using the following DOI: DOI

phase-coherence-for-python's People

Contributors

emma-holmes avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.