In [1]:
%matplotlib inline

In [2]:
import sys
sys.dont_write_bytecode = True
import seaborn as sns
sns.set(style="whitegrid", color_codes=True, font_scale=1.3)
from ggplot import *
from dataMethods import *
from testRuns import *
import pandas as pd
import matplotlib.pyplot as plt


/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/html.py:14: ShimWarning: The `IPython.html` package has been deprecated. You should import from `notebook` instead. `IPython.html.widgets` has moved to `ipywidgets`.
  "`IPython.html.widgets` has moved to `ipywidgets`.", ShimWarning)

In [3]:
dataColumns = ['lHR', 'rHR', 'wHR', 'lK', 'rK', 'wK', 'lfaR', 'rfaR', 'wfaR', 'lHitRT', 'rHitRT', 'wHitRT', 'lFaRT'
               , 'rFaRT', 'wFaRT', 'ldP', 'rdP', 'wdP', 'lCrit', 'rCrit', 'wCrit']

In [4]:
def createDF(testRuns):
    data = pd.DataFrame()
    i = 0
    for (s,r) in testRuns:
        stats = extractPerformance(s,r,'behav6')
        leftHRs = stats['lHRs']
        rightHRs = stats['rHRs']
        wholeHRs = stats['wHRs']
        leftKs = stats['lKs']
        rightKs = stats['rKs']
        wholeKs = stats['wKs']
        leftfaRates = stats['lfaRates']
        rightfaRates = stats['rfaRates']
        wholefaRates = stats['wfaRates']
        leftHitRTs = stats['lHitRTs']
        rightHitRTs = stats['rHitRTs']
        wholeHitRTs = stats['wHitRTs']
        leftFaRTs = stats['lFaRTs']
        rightFaRTs = stats['rFaRTs']
        wholeFaRTs = stats['wFaRTs']
        leftdPs = stats['ldPs']
        rightdPs = stats['rdPs']
        wholedPs = stats['wdPs']
        leftCrits = stats['lCrits']
        rightCrits = stats['rCrits']
        wholeCrits = stats['wCrits']
        for key in HFconds:
            row = pd.Series([leftHRs[key],rightHRs[key], wholeHRs[key], leftKs[key], rightKs[key],
                             wholeKs[key], leftfaRates[key], rightfaRates[key], wholefaRates[key],
                            leftHitRTs[key], rightHitRTs[key], wholeHitRTs[key], leftFaRTs[key], 
                              rightFaRTs[key], wholeFaRTs[key], leftdPs[key], rightdPs[key], 
                              wholedPs[key], leftCrits[key], rightCrits[key], wholeCrits[key]],
                            name = str(i), index=dataColumns)
            row['targs'] = str(HFconds[key][0])
            row['dists'] = str(HFconds[key][1])
            row['subj'] = int(s)
            row['run'] = int(r)
            data = data.append(row)
            i += 1
    return data

In [5]:
pilotData = createDF(pilotTestRuns)

In [6]:
pilotData['rK']


Out[6]:
0     0.705747
1     0.733333
2     0.750000
3     0.708333
4     0.625000
5     0.396552
6     0.870968
7     0.733333
8     0.812500
9     0.933333
10    0.896552
11    1.000000
Name: rK, dtype: float64

In [7]:
pilotData['lHR']


Out[7]:
0     0.9375
1     0.9375
2     0.9375
3     0.8125
4     0.6875
5     0.6250
6     0.8750
7     0.9375
8     0.8125
9     0.8125
10    1.0000
11    0.5625
Name: lHR, dtype: float64

In [8]:
pilotData['rHR']


Out[8]:
0     0.733333
1     0.750000
2     0.750000
3     0.375000
4     0.312500
5     0.250000
6     0.875000
7     0.750000
8     0.812500
9     0.500000
10    0.500000
11    0.500000
Name: rHR, dtype: float64

In [9]:
pilotData['lfaR']


Out[9]:
0     0.093750
1     0.062500
2     0.000000
3     0.032258
4     0.000000
5     0.064516
6     0.031250
7     0.062500
8     0.000000
9     0.062500
10    0.093750
11    0.000000
Name: lfaR, dtype: float64

In [10]:
pilotData['rfaR']


Out[10]:
0     0.093750
1     0.062500
2     0.000000
3     0.032258
4     0.000000
5     0.064516
6     0.031250
7     0.062500
8     0.000000
9     0.062500
10    0.093750
11    0.000000
Name: rfaR, dtype: float64

In [11]:
pilotData


Out[11]:
dists lCrit lFaRT lHR lHitRT lK ldP lfaR rCrit rFaRT ... run subj targs wCrit wFaRT wHR wHitRT wK wdP wfaR
0 0 -0.108055 0.518386 0.9375 0.519150 0.931034 2.852131 0.093750 0.347543 0.527468 ... 1.0 2.0 1 0.164421 0.767935 0.83871 0.518610 0.822024 2.307180 0.093750
1 1 -0.000000 0.568246 0.9375 0.534299 0.933333 3.068241 0.062500 0.429815 0.534299 ... 1.0 2.0 1 0.262065 0.675352 0.84375 0.551627 0.833333 2.544111 0.062500
2 2 0.309877 0.666591 0.9375 0.566061 0.937500 3.687995 0.000000 0.739692 0.566061 ... 1.0 2.0 1 0.571942 NaN 0.84375 0.615387 0.843750 3.163865 0.000000
3 0 0.480725 0.631776 0.8125 0.585273 1.612500 2.735743 0.032258 1.083618 0.601731 ... 1.0 2.0 2 0.805697 0.631776 0.59375 0.585273 1.160417 2.085798 0.032258
4 1 0.832549 0.782170 0.6875 0.598347 1.375000 2.642651 0.000000 1.321326 0.598347 ... 1.0 2.0 2 1.076937 NaN 0.50000 0.657394 1.000000 2.153875 0.000000
5 2 0.599645 0.614811 0.6250 0.561545 1.198276 1.836569 0.064516 1.096209 0.568267 ... 1.0 2.0 2 0.837620 0.706940 0.43750 0.561545 0.797414 1.360618 0.064516
6 0 0.356191 0.567652 0.8750 0.493146 0.870968 3.013081 0.031250 0.356191 0.501128 ... 2.0 2.0 1 0.356191 0.631748 0.87500 0.517963 0.870968 3.013081 0.031250
7 1 -0.000000 0.617920 0.9375 0.501822 0.933333 3.068241 0.062500 0.429815 0.534459 ... 2.0 2.0 1 0.262065 0.701259 0.84375 0.536047 0.833333 2.544111 0.062500
8 2 0.633364 0.564952 0.8125 0.498493 0.812500 3.041021 0.000000 0.633364 0.498493 ... 2.0 2.0 1 0.633364 NaN 0.81250 0.516701 0.812500 3.041021 0.000000
9 0 0.323487 0.609842 0.8125 0.600977 1.600000 2.421267 0.062500 0.767060 0.600977 ... 2.0 2.0 2 0.565935 0.594031 0.65625 0.601105 1.266667 1.936371 0.062500
10 1 -0.272360 0.598524 1.0000 0.592319 2.000000 3.180743 0.093750 0.659005 0.599555 ... 2.0 2.0 2 0.321761 0.649133 0.75000 0.591804 1.448276 1.992501 0.093750
11 2 0.998282 0.615203 0.5625 0.482579 1.125000 2.311185 0.000000 1.076937 0.482579 ... 2.0 2.0 2 1.037731 NaN 0.53125 0.548604 1.062500 2.232287 0.000000

12 rows × 25 columns


In [12]:
pilotWKPlot = sns.factorplot(data=pilotData,x='dists',y='wK',hue='targs')
pilotWKPlot.fig.suptitle('whole-K under pilot')
pilotWKPlot.set_axis_labels('dists', 'K')
pilotWKPlot.fig.subplots_adjust(top=.9)
plt.ylim(0, 2)


Out[12]:
(0, 2)

In [13]:
pilotLKPlot = sns.factorplot(data=pilotData,x='dists',y='lK',hue='targs')
pilotLKPlot.fig.suptitle('left-K under pilot')
pilotLKPlot.set_axis_labels('dists', 'K')
pilotLKPlot.fig.subplots_adjust(top=.9)
plt.ylim(0, 2)


Out[13]:
(0, 2)

In [14]:
pilotRKPlot = sns.factorplot(data=pilotData,x='dists',y='rK',hue='targs')
pilotRKPlot.fig.suptitle('right-K under pilot')
pilotRKPlot.set_axis_labels('dists', 'K')
pilotRKPlot.fig.subplots_adjust(top=.9)
plt.ylim(0, 2)


Out[14]:
(0, 2)

In [15]:
pilotWdPPlot = sns.factorplot(data=pilotData,x='dists',y='wdP',hue='targs')
pilotWdPPlot.fig.suptitle('whole-dP under pilot')
pilotWdPPlot.set_axis_labels('dists', 'dP')
pilotWdPPlot.fig.subplots_adjust(top=.9)
plt.ylim(0.5, 3.5)


Out[15]:
(0.5, 3.5)

In [16]:
pilotLdPPlot = sns.factorplot(data=pilotData,x='dists',y='ldP',hue='targs')
pilotLdPPlot.fig.suptitle('left-dP under pilot')
pilotLdPPlot.set_axis_labels('dists', 'dP')
pilotLdPPlot.fig.subplots_adjust(top=.9)
plt.ylim(0, 3.5)


Out[16]:
(0, 3.5)

In [17]:
pilotRdPPlot = sns.factorplot(data=pilotData,x='dists',y='rdP',hue='targs')
pilotRdPPlot.fig.suptitle('right-dP under pilot')
pilotRdPPlot.set_axis_labels('dists', 'dP')
pilotRdPPlot.fig.subplots_adjust(top=.9)
plt.ylim(0, 3.5)


Out[17]:
(0, 3.5)

In [ ]: