Ejemplo n.º 1
0
def replayBlock(vp,block,trial,tlag=0,coderid=0,exportAlgo=False):
    ''' replays the remaining block from the chase experiment starting at <trial>
        vp - subject id
        block - block id
        trial - trial id on which the replay will start
        tlag - lag in ms on each frame, useful for slowing down the replay
        coderid - coder id whose coding data will be displayed
            if the coding data are not available automated coding will be created
    '''
    behdata=np.loadtxt(os.getcwd().rstrip('code')+'behavioralOutput/vp%03d.res'%vp)
    trialStart=trial
    #win = Q.initDisplay((1280,1100))
    from Preprocess import readEyelink
    data=readEyelink(vp,block)
    #PATH+='coder%d'% coderid +os.path.sep
    for trial in range(trialStart,len(data)):
        print vp,block,trial
        trl=data[trial]
        trl.extractBasicEvents()
        trl.driftCorrection(jump=manualDC(vp,block,trial))
        trl.extractComplexEvents()
        trl.importComplexEvents(coderid=coderid)
    #for trial in range(trialStart,len(data)):
        R=Coder(gazeData=data[trial],phase=1,eyes=1,coderid=coderid)#,wind=win)
        bi=np.logical_and(block==np.int32(behdata[:,1]),trial==np.int32(behdata[:,2])).nonzero()[0][0]
        R.behsel= np.int32(behdata[bi,[-3,-5]])
        if exportAlgo: 
            R.saveSelection(coderid=coderid)
            R.wind.close()
        else: R.play(tlag=tlag)
def plotDC(vp,block,trial):
    ''' plot gaze during drift correction'''
    from Preprocess import readEyelink
    plt.interactive(False)
#    vp=1
#    from readETData import readEyelink
#    for b in range(4,23):
#        print 'block ', b
#        data=readEyelink(vp,b)
#        for i in range(0,len(data)):
    b=block;i=trial
    data=readEyelink(vp,b)
    d=data[i]
    gg=d.getGaze(phase=3)
    plt.plot(gg[:,0],gg[:,1],'g--')
    plt.plot(gg[:,0],gg[:,2],'r--')
    plt.plot(gg[:,0],gg[:,4],'b--')
    plt.plot(gg[:,0],gg[:,5],'k--')
    d.extractBasicEvents()
    d.driftCorrection(jump=manualDC(vp,b,i))
    gg=d.getGaze(phase=3)
    plt.plot(gg[:,0],gg[:,1],'g')
    plt.plot(gg[:,0],gg[:,2],'r')
    plt.plot(gg[:,0],gg[:,4],'b')
    plt.plot(gg[:,0],gg[:,5],'k')
    plt.plot([gg[0,0],gg[-1,0]],[0,0],'k')
    plt.plot(d.dcfix,[-0.45,-0.45],'k',lw=2)
    plt.grid()
    plt.ylim([-0.5,0.5])
    plt.legend(['left x','left y','right x','right y'])
    plt.savefig(PATH+'dc'+os.path.sep+'vp%03db%02dtr%02d'%(vp,b,i))
    plt.cla()
Ejemplo n.º 3
0
def plotMD():
    vp=1
    from Preprocess import readEyelink
    for b in range(1,22):
        plt.cla()
        print 'block ', b
        data=readEyelink(vp,b)
        for d in data:
            d.driftCorrection(jump=manualDC(vp,b,i))
            d.plotMissingData()
        plt.show()
        plt.savefig('fb%02d'%(d.block))
Ejemplo n.º 4
0
def replayTrial(vp,block,trial,tlag=0,coderid=0):
    behdata=np.loadtxt(os.getcwd().rstrip('code')+'behavioralOutput/vp%03d.res'%vp)
    from Preprocess import readEyelink
    data=readEyelink(vp,block)
    trl=data[trial]
    trl.extractBasicEvents()
    trl.driftCorrection(jump=manualDC(vp,block,trial))
    trl.extractComplexEvents()
    trl.importComplexEvents(coderid=coderid)
    R=Coder(gazeData=trl,phase=1,eyes=1,coderid=coderid)
    bi=np.logical_and(block==np.int32(behdata[:,1]),trial==np.int32(behdata[:,2])).nonzero()[0][0]
    R.behsel= np.int32(behdata[bi,[-3,-5]])
    #R.saveSelection(coderid=0)
    R.play(tlag=tlag)
Ejemplo n.º 5
0
def replayTrial(vp,block,trial,tlag=0,coderid=0):
    ''' replays a trial from the chase experiment
        vp - subject id
        block - block id
        trial - trial id
        tlag - lag in ms on each frame, useful for slowing down the replay
        coderid - coder id whose coding data will be displayed
            if the coding data are not available automated coding will be created
    '''
    behdata=np.loadtxt(os.getcwd().rstrip('code')+'behavioralOutput/vp%03d.res'%vp)
    from Preprocess import readEyelink
    data=readEyelink(vp,block)
    trl=data[trial]
    trl.extractBasicEvents()
    trl.driftCorrection(jump=manualDC(vp,block,trial))
    trl.extractComplexEvents()
    trl.importComplexEvents(coderid=coderid)
    R=Coder(gazeData=trl,phase=1,eyes=1,coderid=coderid)
    bi=np.logical_and(block==np.int32(behdata[:,1]),trial==np.int32(behdata[:,2])).nonzero()[0][0]
    R.behsel= np.int32(behdata[bi,[-3,-5]])
    #R.saveSelection(coderid=0)
    R.play(tlag=tlag)
Ejemplo n.º 6
0
def replayBlock(vp,block,trial,tlag=0,coderid=0,exportAlgo=False):
    behdata=np.loadtxt(os.getcwd().rstrip('code')+'behavioralOutput/vp%03d.res'%vp)
    trialStart=trial
    #win = Q.initDisplay((1280,1100))
    from Preprocess import readEyelink
    data=readEyelink(vp,block)
    #PATH+='coder%d'% coderid +os.path.sep
    for trial in range(trialStart,len(data)):
        print vp,block,trial
        trl=data[trial]
        trl.extractBasicEvents()
        trl.driftCorrection(jump=manualDC(vp,block,trial))
        trl.extractComplexEvents()
        trl.importComplexEvents(coderid=coderid)
    #for trial in range(trialStart,len(data)):
        R=Coder(gazeData=data[trial],phase=1,eyes=1,coderid=coderid)#,wind=win)
        bi=np.logical_and(block==np.int32(behdata[:,1]),trial==np.int32(behdata[:,2])).nonzero()[0][0]
        R.behsel= np.int32(behdata[bi,[-3,-5]])
        if exportAlgo: 
            R.saveSelection(coderid=coderid)
            R.wind.close()
        else: R.play(tlag=tlag)