print "First phase..." while True: #first phase (eg. 'resting') try: x = sensor.get_data() t = time.time() - t0 print t, x data.append(x) times.append(t) except KeyboardInterrupt: break breaktime = time.time() - t0 print "Second phase..." while True: #second phase (eg. 'attentive') try: x = sensor.get_data() t = time.time() - t0 print t, x data.append(x) times.append(t) except KeyboardInterrupt: break print "Done - saving to disk ('experiment.dat')" save([data, times, breaktime], "experiment.dat")
def test_save(self): data = [1, 2, 3] gzp.save(data, "test.dat") self.assertTrue(os.path.exists("test.dat"))
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] print "Second phase..." while True: #second phase (eg. 'attentive') 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 print "Done - saving to disk ('experiment.dat')" save([data, times, breaktime, headset.channels[3:17]], "experiment.dat")
oscMsg.append(x) oscMsg.append(t) try: oscClient.send(oscMsg) except: pass except KeyboardInterrupt: break # breaktime = time.time() - t0 # print "Second phase..." # while True: #second phase (eg. 'attentive') # try: # x = sensor.get_data() # t = time.time() - t0 # print t, x # data.append(x) # times.append(t) # except KeyboardInterrupt: # break ts = time.time() timeStamp = datetime.datetime.fromtimestamp(ts).strftime('%Y%m%d_%H%M%S') print("Done - saving to disk (data/" + timeStamp + ".dat)") save([data, times], "data/" + timeStamp + ".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 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")
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] print "Second phase..." while True: #second phase (eg. 'attentive') 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 print "Done - saving to disk ('experiment.dat')" save([data, times, breaktime, headset.channels[3:17]], "experiment.dat")