Giter VIP home page Giter VIP logo

inter-subject_correlation's Introduction

Inter-subject correlation (ISC) for EEG data

This repository contains several functions for calculating inter-subject correlation for electroencephalography (EEG) data. The algorithm was described in details in the next article Correlated Components of Ongoing EEG Point to Emotionally Laden Attention โ€“ A Possible Marker of Engagement?

Getting started

ISC.py contains all necessary functions for calculating Inter-subject correlation (ISC). The function train_cca(data) takes a dictionary where keys are names of conditions and values are 3-D numpy arrays structured like (subjects, channels, samples). It returns a 2-D numpy array W with all spatial filters (which maximize correlation in the data) in descending order.

The function apply_cca(X, W, fs) takes the same X as for training, numpy array of spatial filters and frequency sampling. It returns ISC, ISC_persecond, ISC_bysubject values and scalp projections of spatial filters A.

You can run the example below:

X = dict(Sin=np.random.rand(10, 32, 512*60))
X['Sin'][:,24,:] = np.sin(np.linspace(-np.pi, np.pi, 512*60))
[W, ISC_overall] = train_cca(X)

isc_results = dict()
for cond_key, cond_values in X.items():
    isc_results[str(cond_key)] = dict(zip(['ISC', 'ISC_persecond', 'ISC_bysubject', 'A'], apply_cca(cond_values, W, 250)))

For the visualization you should just run visualization.py after spatial filters are applied.

Some features will be added soon:

  1. Scalp projections of spatial filters.
  2. Statistical tests.
  3. Visualisation with stimuli.

inter-subject_correlation's People

Contributors

levchenkoegor 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.