Monday, October 16, 2017

EEGrunt: A Collection Python EEG

EEGrunt consists of a collection of functions for reading EEG data from CSV files, converting and filtering it in various ways, and finally generating pretty and informative visualizations.

Features

  • EEGrunt is compatible with data from OpenBCI and Muse.
  • EEGrunt has bandpass, notch, and highpass filters for cleaning up powerline interference, OpenBCI's DC offset, and zeroing in on the frequency band you want to analyze.
  • EEGrunt makes it easy to generate signal plots, amplitude trend graphs, spectrograms, and FFT (fast-fouier transform) graphs, etc.

Here is my small code adaptation from the original analyze_data.py file:

# Download the required files from https://github.com/curiositry/EEGrunt
import EEGrunt
source = 'openbci'
path = 'data/'
filename = 'eegrunt-obci-ovibe-test-data.csv'
session_title = "OpenBCI EEGrunt Test Data"

EEG = EEGrunt.EEGrunt(path, filename, source, session_title)
EEG.plot = 'show'

EEG.load_data()
print "\n\n\nChannels:" + str(EEG.channels)

for channel in EEG.channels:
    EEG.load_channel(channel)
    print("Processing channel "+ str(EEG.channel))
    EEG.remove_dc_offset()
    EEG.notch_mains_interference()
    EEG.signalplot()
    EEG.get_spectrum_data()

    EEG.data = EEG.bandpass(0,1)
    EEG.spectrogram()
    EEG.plot_band_power(8,12,"Alpha")
    EEG.plot_spectrum_avg_fft( )

EEG.showplots()


For more information about BCI/EGG press here.


No comments:

Post a Comment