Eyelink test



In [1]:
from cili.util import *
#samps, events = load_eyelink_dataset("/home/avnerus/Code/eegtest/EyeLink/pilotexp_eye.asc")
#samps, events = load_eyelink_dataset("/Volumes/Store/Avner/POUYAN-BRAIN/POUYAN.asc")
samps, events = load_eyelink_dataset("/Volumes/Store/Avner/MATTI-BRAIN/MATTI.asc")


/Volumes/Store/Avner/Projects/socialbonds/venv/lib/python2.7/site-packages/numexpr-2.5.2-py2.7-macosx-10.11-x86_64.egg/numexpr/cpuinfo.py:76: UserWarning: [Errno 2] No such file or directory
  stacklevel=stacklevel + 1):
/Volumes/Store/Avner/Projects/socialbonds/venv/lib/python2.7/site-packages/cili-0.5.3-py2.7.egg/cili/util.py:252: FutureWarning: convert_objects is deprecated.  Use the data-type specific converters pd.to_datetime, pd.to_timedelta and pd.to_numeric.

In [2]:
buttons = events.BUTTON
print(buttons)


           name  b_num  state
5606473  BUTTON      1      1
5606523  BUTTON      1      0
8761209  BUTTON      1      1
8761259  BUTTON      1      0

In [8]:
print samps.loc[5606476]


x_r                     885.8
y_r                     649.6
pup_r                     251
input                       0
samp_warns                ...
targ_x                   5257
targ_y                   4769
targ_dist               715.2
remote_warns    ....F........
Name: 5606476, dtype: object

In [4]:
from cili.extract import extract_event_ranges
#print(samps)


#FIRST INDEX WORK AROUND
#pouyanMs = (48 * 60 + 30) * 1000 + 160
#print("Total Pouyan time: %dms" % (pouyanMs))
#pouyan_start = indexes[0] - pouyanMs
#pouyan_samples = samps.loc[pouyan_start:indexes[0]][['x_r','y_r']] # 1521526

indexes = buttons[(buttons.state == 1)].index
print(indexes)

matti_samples = samps.loc[indexes[0]:indexes[1]][['x_r','y_r']] # 1521526

#interesting_samples = samps.loc[indexes[0]:indexes[1]][['x_r','y_r']] # 1521526


#print(samps.loc[indexes[0]:indexes[1]])
#print(interesting_samples)


Int64Index([5606473, 8761209], dtype='int64')

In [6]:
# Chunk it in SQL
import sqlite3
conn = sqlite3.connect('matti_eyedata.db')
c = conn.cursor()
c.execute('DROP TABLE data')
c.execute('CREATE TABLE data(onset int primary key not null,x_r real,y_r real)')
matti_samples.to_sql('data', conn, if_exists='replace')

In [7]:
conn.commit()
conn.close()

In [ ]:


In [ ]: