def emotiv(e): epoc = Epoc() fid = open('emotiv.dat', 'w') e.wait() t0 = time.time() tp = time.time() while tp - t0 < WINL: tp = time.time() data = epoc.get_raw() m, n = data.shape for i in range(n): fid.write( "%8.12f %8.12f %8.12f %8.12f %8.12f %8.12f %8.12f %8.12f %8.12f %8.12f %8.12f %8.12f %8.12f %8.12f\n" % tuple( data[:, i])) fid.close() print 'Emotiv stop...'
from pyemotiv import Epoc import numpy as np from gzp import save import time """ Sample Emotiv experiment. Gathers data over two phases. Use a keyboard interrupt (control-c) to end a phase. Saves data to disk afterwards. """ headset = Epoc() data = headset.get_raw() times = headset.times t0 = time.time() print "First phase..." while True: #first phase (eg. 'resting') try: x = headset.get_raw() t = headset.times data = np.concatenate((data, x), axis=1) times = np.concatenate((times, t), axis=-1) except KeyboardInterrupt: break breaktime = times[-1]
import numpy as np import keyboard import csv esc = False with open("avanti.csv", "wb") as csvavanti: avanti = csv.writer(csvavanti) with open("indietro.csv", "wb") as csvindietro: indietro = csv.writer(csvindietro) time_passed = 0.0 epoc = Epoc() while not esc: data = epoc.get_raw() if (keyboard.is_pressed('q')): esc = True if (keyboard.is_pressed('a')): print "INVIO AVANTI" avanti.writerow( [str(time_passed), 'af3, ', str(np.average(data[0]))]) avanti.writerow( [str(time_passed), 'f7, ', str(np.average(data[1]))]) avanti.writerow( [str(time_passed), 'f3, ',
from pyemotiv import Epoc from time import sleep from gzp import save import numpy as np if __name__=="__main__": epoc=Epoc() channels= epoc.channels acq = False while True: try: raw = epoc.get_raw() if not acq: data = raw else: data = np.concatenate((data, raw), axis = 1) except KeyboardInterrupt: save(data, "data.dat")
from pyemotiv import Epoc from time import sleep from gzp import save import numpy as np if __name__ == "__main__": epoc = Epoc() channels = epoc.channels acq = False while True: try: raw = epoc.get_raw() if not acq: data = raw else: data = np.concatenate((data, raw), axis=1) except KeyboardInterrupt: save(data, "data.dat")
from pyemotiv import Epoc import numpy as np from gzp import save import time """ Sample Emotiv experiment. Gathers data over two phases. Use a keyboard interrupt (control-c) to end a phase. Saves data to disk afterwards. """ headset = Epoc() data = headset.get_raw() times = headset.times t0 = time.time() print "First phase..." while True: #first phase (eg. 'resting') try: x = headset.get_raw() t = headset.times data = np.concatenate((data, x), axis = 1) times = np.concatenate((times, t), axis = -1) except KeyboardInterrupt: break breaktime = times[-1]