Пример #1
0
from constants import *
from pygaze.display import Display
from pygaze.screen import Screen
from pygaze.eyetracker import EyeTracker

disp = Display()
tracker = EyeTracker(disp)

scr.draw_text(text="Resetting connection to %s tracker" % (TRACKERTYPE), \
    fontsize=24)
disp.fill(scr)
disp.show()

try:
    tracker.stop_recording()
except:
    print("Could not stop recording")

tracker.close()
disp.close()
Пример #2
0
		screen.draw_line(colour=FGC, spos=(gazepos[0]-15, gazepos[1]), epos=(gazepos[0]+15, gazepos[1]), pw=2)
		screen.draw_line(colour=FGC, spos=(gazepos[0], gazepos[1]-15), epos=(gazepos[0], gazepos[1]+15), pw=2)
		# draw point total
		screen.draw_text(text=str(points), colour=FGC, pos=(DISPSIZE[0]*0.9, DISPSIZE[1]*0.1), fontsize=FONTSIZE)
		# update display
		disp.fill(screen=screen)
		disp.show()
		# calculate new stimulus position
		if libtime.get_time() - tstim > STIMREFRESH:
			stimpos = (random.randint(int(DISPSIZE[0]*0.1),int(DISPSIZE[0]*0.9)), random.randint(int(DISPSIZE[1]*0.1),int(DISPSIZE[1]*0.9)))
			tstim = libtime.get_time()

	# stop eye tracking
	trialend = libtime.get_time()
	eyetracker.log("stop_trial %d" % trialnr)
	eyetracker.stop_recording()	


# # # # #
# end

# score display
screen.clear()
screen.draw_text(text="You have scored %d points!" % points, colour=FGC, pos=(DISPSIZE[0]/2, DISPSIZE[1]/2), fontsize=FONTSIZE)
disp.fill(screen=screen)
disp.show()

# wait for keypress
keyboard.get_key(keylist=None, timeout=None)

# highscore display
Пример #3
0
	tracker.log("VALIDATION_TRIALSTART, trialnr=%d, x=%d, y=%d" % (i,x,y))
	# show display
	disp.show()
	tracker.log("validation_point_on")
	# allow for a bit of time so the subject can fixate the target
	clock.pause(1000)
	tracker.log("validation_point_fix")
	# wait for a bit
	clock.pause(POINTTIME)
	# clear screen
	scr.clear()
	disp.fill(scr)
	disp.show()
	# stop recording
	tracker.log("validation_point_off")
	tracker.stop_recording()
	# inter-trial interval
	clock.pause(ITI)

# pause screen
scr.clear()
scr.draw_text(text="Press Space to continue.")
disp.fill(scr)
disp.show()
kb.get_key(keylist=["space"], timeout=None, flush=True)


# # # # #
# IMAGES

# loop through images
Пример #4
0
		screen.draw_line(colour=FGC, spos=(gazepos[0]-15, gazepos[1]), epos=(gazepos[0]+15, gazepos[1]), pw=2)
		screen.draw_line(colour=FGC, spos=(gazepos[0], gazepos[1]-15), epos=(gazepos[0], gazepos[1]+15), pw=2)
		# draw point total
		screen.draw_text(text=str(points), colour=FGC, pos=(DISPSIZE[0]*0.9, DISPSIZE[1]*0.1), fontsize=FONTSIZE)
		# update display
		disp.fill(screen=screen)
		disp.show()
		# calculate new stimulus position
		if libtime.get_time() - tstim > STIMREFRESH:
			stimpos = (random.randint(int(DISPSIZE[0]*0.1),int(DISPSIZE[0]*0.9)), random.randint(int(DISPSIZE[1]*0.1),int(DISPSIZE[1]*0.9)))
			tstim = libtime.get_time()

	# stop eye tracking
	trialend = libtime.get_time()
	eyetracker.log("stop_trial %d" % trialnr)
	eyetracker.stop_recording()	


# # # # #
# end

# score display
screen.clear()
screen.draw_text(text="You have scored %d points!" % points, colour=FGC, pos=(DISPSIZE[0]/2, DISPSIZE[1]/2), fontsize=FONTSIZE)
disp.fill(screen=screen)
disp.show()

# wait for keypress
keyboard.get_key(keylist=None, timeout=None)

# highscore display