Skip to content

Instantly share code, notes, and snippets.

@drammock
Created October 15, 2015 17:15
Show Gist options
  • Save drammock/a6529d4cb9390c32a6ff to your computer and use it in GitHub Desktop.
Save drammock/a6529d4cb9390c32a6ff to your computer and use it in GitHub Desktop.
Test EyeLink connectivity within expyfun
# -*- coding: utf-8 -*-
"""
===============================================================================
Script 'test-eyelink-interactive.py'
===============================================================================
This script tests the connection to the EyeLink eye tracker.
"""
# @author: drmccloy
# Created on Thu Oct 15 09:11:04 2015
# License: BSD (3-clause)
from __future__ import print_function
from expyfun import ExperimentController, EyelinkController
from expyfun.codeblocks import find_pupil_dynamic_range
kwargs = dict(exp_name='testEL', full_screen=True, participant='dev',
session='000', output_dir=None)
with ExperimentController(**kwargs) as ec:
ec.wait_secs(1)
el = EyelinkController(ec)
ec.wait_secs(1)
msg = '\n'.join(['If lost, hit ESC a few times to get to "Offline" Screen',
'then hit ENTER to get to camera setup.',
'',
'From "camera setup" screen:',
' ENTER: toggle sending host UI to display PC',
' up/down arrows: adjust pupil threshold',
' plus/minus keys: adjust corneal reflection',
#' left/right arrows: select eye/global/zoom view',
'',
' Calibration sequence:',
' C to start',
' SPACE to accept initial fixation',
' V to proceed to validation',
' SPACE to accept initial fixation again',
' ENTER to accept',
' O to proceed to output screen / begin recording'])
ec.screen_prompt(msg, font_size=16, attr=False)
el.calibrate()
bgcolor, fcolor, lev, resp = find_pupil_dynamic_range(ec, el)
print(bgcolor, fcolor)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment