Template: Python / PsychoPy / OpenSesame Templates
#1
Please note that with the exception of the recently added PsychoPy Builder templates (see below for download link) the following templates are also provided in our EyeLink Developers Kit. All templates require the Developer's Kit  to be installed in order for them to work.  All templates make use of the Pylink libraries. Please see the Getting Started with Python and PyLink, Getting Started with Psychopy or Getting Started with OpenSesame Guides for installation instructions.

A zip folder containing the Python example templates can be downloaded from the link below:

.zip   Python_examples.zip (Size: 7.75 MB / Downloads: 174)

A zip folder containing additional PsychoPy Builder example templates can be downloaded from the link below:

.zip   PsychoPy_Builder_RC4.zip (Size: 3.95 MB / Downloads: 55)

These Builder example templates implement the same functionality as the core (Coder) PsychoPy templates that are bundled with our Developer's Kit, but the relevant code has been moved to code components within the Builder interface. 

There are three sets of Python example templates:

1) Scripts that do not require PsychoPy and Pygame:
 
Template Description
linkEvent This script shows the frequently used commands for connecting to the tracker, configuring tracker parameters, starting/ending recording, and messaging for event logging. Most importantly, this script shows how to retrieve eye events (Fixation Start / End, Saccade Start / End, etc.) during data recording from the stimulus presentation PC.
linkSample This script shows the frequently used commands for connecting to the tracker, configuring tracker parameters, starting / ending recording, and messaging for event logging. Most importantly, this script shows how to retrieve samples (time stamped gaze position, pupil size, etc.) in real-time during data recording.

2) Scripts that require PsychoPy and / or Pygame:
 
 
Template Description
picture This is a basic example, which shows how to connect to and disconnect from the tracker, how to open and close data files, how to start / stop recording, and the standard messages for integration with the Data Viewer software. We show four pictures one-by-one on each trial, and a trial terminates upon a keypress response or until 3 secs have elapsed.
pursuit This example script shows how to record the target position in a smooth pursuit task. This script also shows how to record dynamic interest area and target position information to the EDF data file so Data Viewer can recreate the interest area and playback the target movement.
saccade This example script shows how to retrieve eye events (saccades) during testing. A visual target appears on the left side, or right side of the screen and the participant is required to quickly shift gaze to look at the target (pro-saccade) or a mirror location on the opposite side of the central fixation (anti-saccade).
fixationWindow_fastSamples This is a basic example, which shows how to implement a gaze-based trigger. First a fixation cross is shown at the center of the screen. The trial moves on only when gaze has been directed to the fixation cross.
GC_window This script shows how to manipulate visual stimuli based on real-time gaze data. A mask is shown at the current gaze position in the "mask" condition; in the "window" condition, the image is masked, and a window at the current gaze position will reveal the image hidden behind the mask.
MRI_demo This is a basic example illustrating how to do continuous eye tracker recording through a block of trials (e.g., in an MRI setup), and how to synchronize the presentation of trials with a sync signal from the MRI. With a long recording, we start and stop recording at the beginning and end of a testing session (run), rather than at the beginning and end of each experimental trial. We still send the TRIALID and TRIAL_RESULT messages to the tracker, and Data Viewer will still be able to segment the long recording into small segments (trials).
video (PsychoPy only) A simple video demo. In each trial eye movements are recorded while a video stimulus is presented on the screen.


3) Scripts for OpenSesame users (requires the OpenSesame EyeLink Plugin):

Please see the Getting Started with OpenSeasame Guide for installation instructions.

Template Description
OpenSesame_Picture This basic example shows how to connect to and disconnect from the tracker, how to open and close data files, how to start / stop recording, and illustrates the standard messages for integration with Data Viewer software. The task shows four pictures one-by-one on each trial, and a trial terminates upon a keypress response or until 3 secs have elapsed.
OpensSesame_VW_Click A popular eye-tracking task in language studies. The inline scripts used in this project are explained in the User Manual.