Exploring Eye gaze data

First setup the variables raw, working and output folder as well as import the eyegaze file for reading and filtering eyegaze data.


In [222]:
import eyegaze as eg
reload(eg)

raw_folder = './data/raw/'
work_folder = './data/work/'
out_folder = './output/'

manga_fname = raw_folder +'manga.txt'
novel_fname = raw_folder +'novel.txt'
textb_fname = raw_folder +'textbook.txt'
  • Read in 3 files: a person reading manga, Japanese novel and a textbook for around 10 minutes.
  • Save the results in a cvs file in the working directory

In [61]:
m_time, m_x, m_y = eg.read_raw(manga_fname)
n_time, n_x, n_y = eg.read_raw(novel_fname)
t_time, t_x, t_y = eg.read_raw(textb_fname)

eg.save_raw(work_folder+'manga_raw.csv',m_time, m_x, m_y)
eg.save_raw(work_folder+'novel_raw.csv',n_time, n_x, n_y)
eg.save_raw(work_folder+'textb_raw.csv',t_time, t_x, t_y)

In [208]:
plot(m_x[450:650], m_y[450:650],'-o')
title('manga')
xlabel('x')
ylabel('y')

figure()
plot(n_x[450:650], n_y[450:650],'-o')
title('novel')
xlabel('x')
ylabel('y')

figure()
plot(t_x[450:650], t_y[450:650],'-o')
title('textbook')
xlabel('x')
ylabel('y')


Out[208]:
<matplotlib.text.Text at 0x10e74b110>

Filtering


In [216]:
mf_time,mf_d, mf_x, mf_y = eg.filter_fixations(m_time,m_x,m_y)
nf_time,nf_d, nf_x, nf_y = eg.filter_fixations(n_time,n_x,n_y)
tf_time,tf_d, tf_x, tf_y = eg.filter_fixations(t_time,t_x,t_y)

plot(mf_x[450:650], mf_y[450:650],'-o')
figure()
plot(nf_x[450:650], nf_y[450:650],'-o')
figure()
plot(tf_x[450:650], tf_y[450:650],'-o')


Out[216]:
[<matplotlib.lines.Line2D at 0x10eabd6d0>]

adding the fixation duration to the plot.


In [219]:
eg.pplot(mf_x[450:650], mf_y[450:650],mf_d[450:650])
title('manga')
xlabel("x")
ylabel("y")

eg.pplot(nf_x[450:650], nf_y[450:650],nf_d[450:650])
title('novel')
xlabel("x")
ylabel("y")

eg.pplot(tf_x[450:650], tf_y[450:650],tf_d[450:650])
title('textbook')
xlabel("x")
ylabel("y")


Out[219]:
<matplotlib.text.Text at 0x10e84e810>

Feature Calulation


In [223]:
reload(eg)
ms1,ms2,ms3,ms4=eg.get_saccade_directions(mf_d,mf_x,mf_y)
ns1,ns2,ns3,ns4=eg.get_saccade_directions(nf_d,nf_x,nf_y)
ts1,ts2,ts3,ts4=eg.get_saccade_directions(tf_d,tf_x,tf_y)

In [224]:
plot(ms1,ms2,'v')
plot(ns1,ns2,'o')
plot(ts1,ts2,'*')
title('feature plot')
xlabel("saccade right")
ylabel("saccade down")


Out[224]:
<matplotlib.text.Text at 0x10ee92350>

In [ ]: