View Single Post
  #1  
Old 08-06-2014, 08:07 AM
chris2307 chris2307 is offline
Member
 
Join Date: Nov 2013
Posts: 36
Unable to draw EyeLink drift correction to screen

Hi all,

I am running an experiment in a loop. When a new trial begins, I would like to call the EyeLink 2 drift correction function. I've been able to call the menu for calibration before starting the experiment just fine.

The problem is that my function does run and the drift correction routine is initialised (I can see this from the EyeTracker PC). However, I am unable to get the eye tracker to override the screen in order to display the drift correction dot.

Instead, the experiment continues to be displayed on the screen, although is blocked whilst it waits for the drift correction routine to be exited.

Code:
import viz	
import os
import vizact
import viztask
import math
#import pyxid
import win32api
import win32con

sys.path.append(os.getcwd() + '/functions')

import LoadLevel
import screen
import Lights
import Physics
import EyeTracker
from text import Text
from movement import Movement
from toDataFile import toDataFile
from StaticVisualSearchTask import StaticVisualSearchTaskExperiment

userMovement = Movement(10)
text = Text()

EyeTracker.beginExperiment()
EyeTracker.setupTracker()
EyeTracker.testTrial()

experiment = StaticVisualSearchTaskExperiment()
toFile = toDataFile(experiment.getParticipantID())

def runExperiment():
	
	yield experiment.prepareTrial(experiment.currentPhase())
	toFile.newTrial(experiment.getTrialData(), experiment.getTrialNumber())

	while True:
		
		if(experiment.hasTrialEnded() == False):
			
			if(experiment.isNewPhase() == True):
				yield experiment.prepareTrial(experiment.currentPhase())
				toFile.asRaw("<phase_number>" + str(experiment.currentPhase()) + "</phase_number>")
				
			if(experiment.currentPhase() == 1):
				userMovement.disable()
				yield experiment.runPhase1(JOY_YES = userMovement.returnButtonYES(), JOY_NO = userMovement.returnButtonNO())
			elif(experiment.currentPhase() == 2):
				userMovement.enable()
				yield experiment.runPhase2(JOY_YES = userMovement.returnButtonYES(), JOY_NO = userMovement.returnButtonNO())
			elif(experiment.currentPhase() == 3):
				userMovement.enable()
				yield experiment.runPhase3(JOY_YES = userMovement.returnButtonYES(), JOY_NO = userMovement.returnButtonNO())
				
			toFile.asTrialTick(EyeTracker.getCurrentGaze())
			toFile.asTrialTick(viz.mouse.getPosition(viz.WINDOW_PIXELS))
		else:
			toFile.endTrial(experiment.getTrialResult())
			if(experiment.hasExperimentEnded() == False):
				yield EyeTracker.driftCorrection() # <------------------------------------------------- Here is where I attempt to carry out a drift correction
				yield experiment.nextTrial()
				yield experiment.prepareTrial(experiment.currentPhase())
				toFile.newTrial(experiment.getTrialData(), experiment.getTrialNumber())
			else:
				yield experiment.finish()
				break

	viz.quit()

viztask.schedule(runExperiment())
I'm hoping it is something obvious but if it's not, please let me know and I'll get more information put up on here.

Thanks
Reply With Quote