コード例 #1
0
ファイル: spSigProc.py プロジェクト: jadref/buffer_bci
import sys,os
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)),"../../dataAcq/buffer/python"))
sys.path.append("../signalProc")
import preproc
import bufhelp
#import linear
import pickle

bufhelp.connect()

trlen_ms = 600
run = True

print ("Waiting for startPhase.cmd event.")
while run:
    e = bufhelp.waitforevent("startPhase.cmd",1000, True)
    print("Got startPhase event: %s"%e)
    if e is not None:

        if e.value == "calibration":
            print("Calibration phase")
            data, events, stopevents = bufhelp.gatherdata("stimulus.tgtFlash",trlen_ms,("stimulus.training","end"), milliseconds=True)
            pickle.dump({"events":events,"data":data}, open("subject_data", "w"))

        elif e.value == "train":
            print("Training classifier")
            data = preproc.detrend(data)
            data, badch = preproc.badchannelremoval(data)
            data = preproc.spatialfilter(data)
            data = preproc.spectralfilter(data, (0, .1, 10, 12), bufhelp.fSample)
            data, events, badtrials = preproc.badtrailremoval(data, events)
コード例 #2
0
import sys
sys.path.append("../../dataAcq/buffer/python")
sys.path.append("../signalProc")
import preproc
import bufhelp
#import linear
import pickle

bufhelp.connect()

trlen_ms = 600
run = True

print "Waiting for startPhase.cmd event."
while run:
    e = bufhelp.waitforevent("startPhase.cmd",1000, False)
    
    if e is not None:

        if e.value == "calibration":
            print "Calibration phase"
            data, events, stopevents = bufhelp.gatherdata("stimulus.tgtFlash",trlen_ms,("stimulus.training","end"), milliseconds=True)
            pickle.dump({"events":events,"data":data}, open("subject_data", "w"))

        elif e.value == "train":
            print "Training classifier"
            data = preproc.detrend(data)
            data, badch = preproc.badchannelremoval(data)
            data = preproc.spatialfilter(data)
            data = preproc.spectralfilter(data, (0, .1, 10, 12), bufhelp.fSample)
            data, events, badtrials = preproc.badtrailremoval(data, events)
コード例 #3
0
ファイル: spSigProc.py プロジェクト: kstandvoss/BCI17
    os.path.join(os.path.dirname(os.path.abspath(__file__)),
                 "../../dataAcq/buffer/python"))
sys.path.append("../signalProc")
import preproc
import bufhelp
#import linear
import pickle

bufhelp.connect()

trlen_ms = 600
run = True

print("Waiting for startPhase.cmd event.")
while run:
    e = bufhelp.waitforevent("startPhase.cmd", 1000, True)
    print("Got startPhase event: %s" % e)
    if e is not None:

        if e.value == "calibration":
            print("Calibration phase")
            data, events, stopevents = bufhelp.gatherdata(
                "stimulus.tgtFlash",
                trlen_ms, ("stimulus.training", "end"),
                milliseconds=True)
            pickle.dump({
                "events": events,
                "data": data
            }, open("subject_data", "w"))

        elif e.value == "train":
コード例 #4
0
import sys
sys.path.append("../../dataAcq/buffer/python")
sys.path.append("../signalProc")
import preproc
import bufhelp
#import linear
import pickle

bufhelp.connect()

trlen_ms = 600
run = True

print "Waiting for startPhase.cmd event."
while run:
    e = bufhelp.waitforevent("startPhase.cmd", 1000, False)

    if e is not None:

        if e.value == "calibration":
            print "Calibration phase"
            data, events, stopevents = bufhelp.gatherdata(
                "stimulus.tgtFlash",
                trlen_ms, ("stimulus.training", "end"),
                milliseconds=True)
            pickle.dump({
                "events": events,
                "data": data
            }, open("subject_data", "w"))

        elif e.value == "train":