Coder Social home page Coder Social logo

bcipy's Introduction

© 2013, 2014 Justis Grant Peters and Sagar Jauhari

BCIpy

Python toolkit to analyse EEG data

Code repository for our project in Educational Data Mining class with Dr. Tiffany Barnes, CSC 591-021 Fall 2013 at NCSU. We are analyzing EEG data collected by Mostow and Chang from Project LISTEN.

Using the data processing pipeline

$ python process_eeg.py -h
usage: process_eeg.py [-h] -i INDIR -o OUTDIR [--interpolate] [--kernelsvm]
                  	[--chartsforpaper]

Process EEG Data.

optional arguments:
  -h, --help        show this help message and exit
  -i INDIR          Directory containing raw EEG Files.
  -o OUTDIR         Path of processed data and reports. New directory with
                    timestamp will be created inside this folder.
  --interpolate     Interpolate 512Hz time stamps on 512Hz data having 1Hz
                    time stamps (raw data available from CMU)
  --kernelsvm       Perform Kernelized SVC on interpolated raw data
  --chartsforpaper  Create charts in single page PDF files.

Processing timeseries data from CMU

The 512Hz data from CMU has timestamp information, but only at 1Hz resolution. To interpolate these:

python process_series_files.py data/raw/ preprocess/raw/

Using slicer

The Slicer class manages timeseries and extracted features as they relate to tasks from task.xls.

# instantiating task slicer
s = Slicer()

if len(sys.argv) > 2:
		print 'loading raw from list of csvfiles'
		s.load_series_from_csv('raw', sys.argv[1:])
else:
		print 'loading raw from pickle'
		s.load_series_from_pickle('raw', sys.argv[1])

# extract features from 'raw'
s.extract_filtered_signal()
s.extract_rolling_median()
s.extract_rolling_PSD()

# fetch task 1, with features
# Return type is a dict, with task-level features, plus the requested timeseries features
print s.get_by_task_id(1, features=['raw','raw_rolling_PSD_512', 'raw_rolling_median_128'])

Using Python notebooks

sudo apt-get install ipython
git clone [email protected]:sagarjauhari/edm_eeg.git edm_eeg.git
cd edm_eeg.git
ipython notebook --pylab-inline

Running R scripts

To run an R script, for example sketchpad.R:

cd dir-with-eeg-data/
R --vanilla < /path/to/sketchpad.R

It will produce a PDF called Rplots.pdf with a page for each chart produced by the script.

Patching the data

If you're using eeg_data_set2.zip_, you will want to fix the first line in 20101214171219.1.rawwave.csv to look like this:

%Time,Value

License and Copyright

© 2013, 2014 Justis Grant Peters and Sagar Jauhari

This file is part of BCIpy.

BCIpy is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

BCIpy is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with BCIpy. If not, see http://www.gnu.org/licenses/.

Dependencies

  • PyEEG - Licenced under GPL V3

bcipy's People

Contributors

sagarjauhari avatar justis avatar

Watchers

 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.