In [43]:
from scipy import signal, stats
import numpy as np
import pandas as pd
from time import time, strftime, gmtime
from pylsl import StreamInlet, resolve_byprop
from matplotlib.pyplot import *

from collect_tools import collect_eeg

%matplotlib inline

In [44]:
print("looking for an EEG stream...")
streams = resolve_byprop('type', 'EEG', timeout=2)

if len(streams) == 0:
    print('No streams found! Are you streaming data?')
else:
    print('Found stream!')


looking for an EEG stream...
Found stream!

In [45]:
inlet = StreamInlet(streams[0], max_chunklen=24)

In [46]:
print("baseline: just stay still and don't smell too much\n")
baseline = collect_eeg(inlet,duration=10, tag='baseline')


baseline: just stay still and don't smell too much

Start recording at time t=1491953530.525
Finished recording at time 1491953540.611 (10.086 seconds)

In [47]:
print("smell: try to smell the object as much as possible\n")
smell = collect_eeg(inlet,duration=10, tag='smell')


smell: try to smell the object as much as possible

Start recording at time t=1491953540.627
Finished recording at time 1491953550.697 (10.069 seconds)

In [48]:
data = pd.concat([baseline, smell])
last = np.array(data.timestamps)[-1]
last = int(float(last))
fname = 'data/smell_{}.csv'.format(last)
data.to_csv(fname, index=False)
print('data saved in:\n{}'.format(fname))


data saved in:
data/smell_1491953550.csv

In [ ]: