import highscores from constants import * from pygaze import libtime from pygaze.libscreen import Display, Screen from pygaze.libinput import Keyboard from pygaze.eyetracker import EyeTracker import random # # # # # # prep # create keyboard object keyboard = Keyboard() # display object disp = Display() # screen objects screen = Screen() blankscreen = Screen() hitscreen = Screen() hitscreen.clear(colour=(0,255,0)) misscreen = Screen() misscreen.clear(colour=(255,0,0)) # create eyelink objecy eyetracker = EyeTracker(disp)
from pygaze.liblog import Logfile from pygaze.libgazecon import FRL # timing and initialization libtime.expstart() # visuals disp = Display() scr = Screen() # eye tracking tracker = EyeTracker(disp, trackertype='dummy') frl = FRL(pos='center', dist=125, size=200) # input collection and storage kb = Keyboard(keylist=['escape', 'space'], timeout=None) log = Logfile() log.write(["trialnr", "trialstart", "trialend", "duration", "image"]) # run trials tracker.calibrate() for trialnr in range(0, len(IMAGES)): # blank display disp.fill() disp.show() libtime.pause(1000) # prepare stimulus scr.clear() scr.draw_image(IMAGES[trialnr]) # start recording eye movements tracker.drift_correction()
from pygaze import eyetracker from pygaze import liblog from pygaze.libinput import Keyboard from Functions import * from heatmap import * from threads import * from voicerecognition import * import threading import queue kb = Keyboard(keylist=['space', '1', '2', '3', '4', '5', 'escape'], timeout=1) date = timeanddate() musiccommands(music) disp = libscreen.Display() tracker = eyetracker.EyeTracker(disp) importimages(imgs) scrsttart = startscreen() disp.fill(scrsttart) disp.show() musicpath(os.path.join(SOUNDDIR, 'Start.wav')).play() time.sleep(2.8) e = threading.Event() e.set() thread1 = threading.Thread(target=voicerec, args=("start", e)) thread1.start() spacepass(kb, e) thread1.join() scrsttart.clear() for images in range(len(imgs)): print "e" img = resizeimagefunction(imgs[images], calcresolution()) a = imagescreen(img)
if not os.path.exists(session_folder_path): os.mkdir(session_folder_path) if not os.path.exists(fmri_folder_path): os.mkdir(fmri_folder_path) if not os.path.exists(debug_folder_path): os.mkdir(debug_folder_path) if withTracker and not os.path.exists(tracker_folder_path): os.mkdir(tracker_folder_path) while os.path.exists(os.path.join(debug_folder_path, basename + '_debug.log')): basename += '+' # In[Initiate PyGaze Objects]: if inScanner: kb = Keyboard() # In[Initiate PsychoPy Objects]: psychopy.event.clearEvents() win = psychopy.visual.Window(size=[res[0], res[1]], units="pix", fullscr=True, waitBlanking=True) timg = psychopy.visual.ImageStim(win=pygaze.expdisplay, image="right.png", units="pix", pos=(base_dist_pix, 0), opacity=1)
MESSAGE = "AFK; BRB" # import stuff import random from pygaze.defaults import * from pygaze import libtime from pygaze.libscreen import Display, Screen from pygaze.libinput import Keyboard # start timing libtime.expstart() # objects disp = Display() scr = Screen() kb = Keyboard(keylist=['space'], timeout=1) # run annoying message while kb.get_key()[0] == None: # colour col = (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255)) # position pos = (random.randint(0, DISPSIZE[0]), random.randint(0, DISPSIZE[1])) # text scr.draw_text(text=MESSAGE, colour=col, pos=pos, fontsize=84) # display disp.fill(scr) disp.show() # reset screen scr.clear()
from swap_images import swap import random import pygame import time center_of_screen = (DISPSIZE[0] / 2, DISPSIZE[1] / 2) image_HW = 326 # create display object disp = Display() # create eyetracker object tracker = eyetracker.EyeTracker(disp) # create keyboard object keyboard = Keyboard(keylist=['space', "q", "escape"], timeout=1) # create logfile (txt file that is tab seperated, I think) our_log = liblog.Logfile() # write "headlines" to log file our_log.write( ["trialnr", "trialstart", "trialend", "disengagementtime", "imagepair"]) # fill in with the neccecary headlines # calibrate the eye-tracker tracker.calibrate() # make the sets of images image_set = generate() #shuffle our image sets shuffle(image_set)
#DUMMYMODE = True # set in constants.py # To use your code with the new Tobii Pro SDK, # set the TRACKERTYPE to 'tobii' # start timing libtime.expstart() # create display object disp = Display() # create eyetracker object tracker = eyetracker.EyeTracker(disp) # create keyboard object keyboard = Keyboard(keylist=['space', "q"], timeout=1) center_of_screen = (DISPSIZE[0] / 2, DISPSIZE[1] / 2) # create screen to draw things on screen1 = Screen() screen1.draw_fixation(fixtype='cross', pos=center_of_screen, colour=(255, 255, 255), pw=5, diameter=30) screen2 = Screen() #screen1.draw_image(base_path, pos=(center_of_screen[0]-300,center_of_screen[1]), scale=None) #need screen width #screen2.draw_image(base_path1, pos=(center_of_screen[0]+300,center_of_screen[1]), scale=None) #need screen width screen3 = Screen()