Welcome!

Sign in with your CogSci, Facebook, Google, or Twitter account.

Or register to create a new account.

We'll use your information only for signing in to this forum.

Supported by

[open] Invisible boundary trigger for eye tracking

JohnLJonesJohnLJones Posts: 7
edited July 2013 in OpenSesame

Hi,

Is there a way to create invisible boundary triggers with open sesame? The effect that I want to achieve is to tabulate how many trials participants move their gaze from a central fixation before prompted to do so.

Thanks!
John

Comments

  • EdwinEdwin Posts: 655
    edited July 2013

    Hi John,

    There isn't a ready-made plug-in, but you could use an inline_script to do so using exp.eyelink.sample() (see here). An example script that waits until the gaze position has been moved too far from a central fixation point:

    (place the following in the Run phase of an inline_script item)

    # import relevant stuff
    from openexp.canvas import canvas
    
    # max deviation
    maxdev = 60 # pixels from fixation dot
    
    # fixation position at half the screen width and half the screen height (i.e.: the screen center)
    fixpos = (self.get("width")/2, self.get("height")/2)
    
    # draw and show the fixation canvas
    cv = canvas(exp)
    cv.fixdot(x=fixpos[0], y=fixpos[1])
    
    # show canvas and wait for movement
    moved = False
    t0 = cv.show()
    while not moved:
        x, y = exp.eyelink.sample() # the sample method returns the most recent x and y gaze coordinates
        if (x-fixpos[0])**2 + (y-fixpos[1])**2 > maxdev**2:
            t1 = self.time()
            moved = True
    
    # save some variables, to use in the OpenSesame GUI
    exp.set("fixation_duration", t1-t0)
    

    Does this help?

Sign In or Register to comment.