Connector Class¶
This class provides methods for interacting with the Eyelink from psychopy.
-
class
connector.
Connect
(window, edfname)¶ Provides functions for interacting with the EyeLink via Pylink.
Parameters: - window – Psychopy window object.
- edfname (str) – Desired name of the EDF file.
-
calibrate
(cnum=13, paval=1000)¶ Calibrates eye-tracker using psychopy stimuli.
Parameters: - cnum (int) – Number of points to use for calibration. Options are 3, 5, 9, 13.
- paval (int) – Pacing of calibration, i.e. how long you have to fixate each target in milliseconds.
-
convert_coords
(x, y, to='eyelink')¶ Converts from degrees visual angle units to EyeLink Pixel units.
Parameters: - x (float or int) – X coordinate in visual angle.
- y (float or int) – Y coordinate in viusal angle.
- to – Direction of conversion. Options: ‘eyelink’ or ‘psychopy’.
Returns: Two values in order x, y
-
draw_ia
(x, y, size, index, color, name)¶ Draws square interest area in EDF and a corresponding filled box on eye-tracker display. Must be called after
set_trialid()
for interest areas to appear in the EDF.Parameters: - x (float or int) – X coordinate in degrees visual angle for center of check area.
- y (float or int) – Y coordinate in degrees visual angle for center of check area.
- size (float or int) – length of one edge of square in degrees visual angle.
- index (int) – number to assign interest area in EDF
- color (int) – color of box drawn on eye-tracker display (0 - 15)
- name (str) – Name of interest area in EDF
-
draw_text
(msg)¶ Draws text on eye-tracker screen.
Parameters: msg (str) – Text to draw.
-
end_experiment
(spath)¶ Closes and transfers the EDF file.
Parameters: spath (str) – Absolute file path of where to save the EDF file.
-
fix_check
(size, ftime, button)¶ Checks that fixation is maintained for certain time.
Parameters: - size (float or int) – Length of one side of box in degrees visual angle.
- ftime (float) – Length of time to check for fixation in seconds.
- button (char) – Key to press to recalibrate eye-tracker.
-
get_gaze
()¶ Gets current gaze position of eye. Must be called between
record_on()
andrecord_off()
. Sendlink must be set to True as well.Returns: list of coordinates in the form of [x, y].
-
record_off
()¶ Stops recording.
-
record_on
(sendlink=False)¶ Starts recording. Waits 50ms to allow eyelink to prepare.
Parameters: sendlink (bool) – Toggle for sending eye data over the link to the display computer during recording.
-
sac_detect
(x, y, radius)¶ Checks if current gaze position is outside a circular interest area.
Parameters: - x (float or int) – X coordinate in degrees visual angle for center of circle IA.
- y (float or int) – Y coordinate in degrees visual angle for center of circle IA.
- radius (float or int) – Radius of detection circle in degrees visual angle.
Returns: List of whether saccade was detected and the gaze coordinates
at time of detection. In the form of [bool, [x, y]]. :rtype: bool, list
-
send_command
(cmd)¶ Sends a command to the Eyelink.
Parameters: cmd (str) – Command to send.
-
send_message
(txt)¶ Sends a message to the tracker that is recorded in the EDF.
Parameters: txt (str) – Message to send.
-
send_var
(name, value)¶ Sends a trial variable to the EDF file.
Parameters: - name (str) – Name of variable.
- value (float, str, or int) – Value of variable.
-
set_status
(message)¶ Sets status message to appear while recording.
Parameters: message (str) – Text object to send, must be < 80 char
-
set_trialid
(idval=1)¶ Sends message that indicates start of trial in EDF.
Parameters: idval – Values to set TRIALID.
-
set_trialresult
(rval=0, scrcol=0)¶ Sends trial result to indiciate trial end in EDF and clears screen on EyeLink Display.
Parameters: - rval (float, str, or int) – Value to set for TRIAL_RESULT.
- scrcol (int) – Color to clear screen to. Defaults to black.