def loop(): systime = time.time() * 1000 global kivyObj global usbconn if(PLOT): plot = plt(1) plot2 = plt(2) global blinkFilterX global blinkFilterY global stateFilter global calibrator while True: signX = usbconn.getXdata() signY = usbconn.getYdata() normX = blinkFilterX.getFilteredSignal(signX) normY = blinkFilterY.getFilteredSignal(signY) if(PLOT): plot2.draw(signY) plot.draw(signX) if stateFilter.getState() != EOGState.Calibrating: stateFilter.handleSignal(signX,signY) else: calibrator.calibrate(signX,signY,stateFilter) if(KIVY): kivyObj.draw(stateFilter.getState()) #EOGState.printState(stateFilter.getState()) systime = checkTime(systime)
def q5(): if flask.request.method == 'GET': client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('aheckman_jfimbres', 'aheckman_jfimbres') questions = repo.aheckman_jfimbres.questions.find({}) questions = questions[0] q = questions.get('q5') plt(q) return render_template('hello.html', message='image')
def loop(): systime = time.time() * 1000 global kivyObj global usbconn TEST_FILE = "C:/Users/Pieter/Documents/Documenten/--- SCHOOL ---/FASE III/WV/eog_project/Experimenten/paperexperimenten/driftdata.csv" if(TOFILE): if(not os.path.isfile(TEST_FILE)): fh = open(TEST_FILE,"w") fh.write("") fh.close() if(PLOT): plot = plt(1) plot2 = plt(2) global blinkFilterX global blinkFilterY global stateFilter2 global calibrator while True: signX = usbconn.getXdata() signY = usbconn.getYdata() normX = blinkFilterX.getFilteredSignal(signX) normY = blinkFilterY.getFilteredSignal(signY) if(TOFILE): fh = open(TEST_FILE,"a") output = (str(signX)+";"+str(signY) + "\n") fh.write(output) fh.close if(PLOT): plot2.draw(signX) plot.draw(signY) ##If there is no need for calibration handle the signal in the stateFilter. ##Else let the calibrator, calibrate the signal. if stateFilter2.getState() != EOGState.Calibrating: stateFilter2.handleSignal(normX,normY) else: calibrator.calibrate(normX,normY,stateFilter2) if(KIVY): kivyObj.draw(stateFilter2.getState()) #Print the state to the console for debugging purposes #EOGState.printState(stateFilter2.getState()) #Check the system time. This wil wait for the next iteration, based on the loopspersec. systime = checkTime(systime)