コード例 #1
0
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")
コード例 #2
0
ファイル: experiment.py プロジェクト: imclab/pyneulog
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")
コード例 #3
0
ファイル: test_main.py プロジェクト: alkuzad/pickle-gzip
 def test_save(self):
     data = [1, 2, 3]
     gzp.save(data, "test.dat")
     self.assertTrue(os.path.exists("test.dat"))
コード例 #4
0
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")
コード例 #5
0
        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")
コード例 #6
0
ファイル: example.py プロジェクト: imclab/pyemotiv
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")
コード例 #7
0
ファイル: test_main.py プロジェクト: thearn/pickle-gzip
 def test_save(self):
     data = [1, 2, 3]
     gzp.save(data, "test.dat")
     self.assertTrue(os.path.exists("test.dat"))
コード例 #8
0
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")
コード例 #9
0
ファイル: experiment.py プロジェクト: imclab/pyemotiv
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")