Skip to main content

Counting Programs

In [1]:
%run prelude.ipy
In [2]:
counting_trials = util.filter_program(trials, "counting")
twospace_trials = util.filter_program(counting_trials, "counting", "twospaces")
counting_fixes = util.filter_program(all_fixations, "counting")
In [3]:
twospaces_fixes = util.filter_program(counting_fixes, "counting", "twospaces")
twospaces_fixes = twospaces_fixes.merge(counting_trials[["trial_id", "grade_correct"]], on="trial_id")
twospaces_fixes
/usr/local/lib/python2.7/dist-packages/pandas/core/config.py:570: DeprecationWarning: height has been deprecated.

  warnings.warn(d.msg, DeprecationWarning)

Out[3]:
<class 'pandas.core.frame.DataFrame'>
Int64Index: 3414 entries, 0 to 3413
Data columns (total 16 columns):
exp_id           3414  non-null values
trial_id         3414  non-null values
base             3414  non-null values
version          3414  non-null values
offset_kind      3414  non-null values
hit_kind         3414  non-null values
start_ms         3414  non-null values
end_ms           3414  non-null values
fix_x            3414  non-null values
fix_y            3414  non-null values
aoi_interface    3059  non-null values
aoi_line         1650  non-null values
aoi_syntax       1654  non-null values
aoi_block        1684  non-null values
duration_ms      3414  non-null values
grade_correct    3414  non-null values
dtypes: bool(1), int64(7), object(8)
In [4]:
correct, incorrect = twospace_trials[twospace_trials.grade_correct], twospace_trials[-twospace_trials.grade_correct]
print len(correct), len(incorrect)
25 48

In [5]:
c1_fixes = twospaces_fixes[twospaces_fixes.trial_id == correct.iloc[0]["trial_id"]]
In [6]:
from eyecode import aoi
aoi_names = {"line": None, "interface": ["output box"]}
In [7]:
sp1, name_map = aoi.aoi_scanpath(c1_fixes, aoi_names, mixed=True, repeats=False)
In [8]:
tm_c1 = aoi.transition_matrix(sp1)
tm_c1
Out[8]:
array([[ 0.        ,  0.11538462,  0.15384615,  0.73076923],
       [ 0.18181818,  0.        ,  0.68181818,  0.13636364],
       [ 0.33333333,  0.3       ,  0.        ,  0.36666667],
       [ 0.39393939,  0.27272727,  0.33333333,  0.        ]])
In [10]:
ax = plot.aoi.aoi_transitions(tm_c1, name_map)
ax.set_title("Transitions (counting twospaces, correct)")
ax.figure.tight_layout()
ax.figure
Out[10]:

Incorrect

In [11]:
i1_fixes = twospaces_fixes[twospaces_fixes.trial_id == incorrect.iloc[0]["trial_id"]]
sp2, name_map = aoi.aoi_scanpath(i1_fixes, aoi_names, mixed=True, repeats=False)
tm2 = aoi.transition_matrix(sp2)
In [12]:
ax = plot.aoi.aoi_transitions(tm2, name_map)
ax.set_title("Transitions (counting twospaces, incorrect)")
ax.figure.tight_layout()
ax.figure
Out[12]: