Iohub EyeLink calibration: PsychoPy freezes at .runSetupProcedure()

Hi everyone!
I’m trying to set up PsychoPy with an EyeLink 1000 eyetracker but am unable to start the calibration via Iohub’s .runSetupProcedure() method.
Everything else seems to work fine, but PsychoPy freezes when it calls the method and the eyetracker host computer does also not switch to setup mode.

Calibration works fine via SR Research’s Track.exe and also via their Eyelink library (as provided by Zhiguo Wang).
My testing script is adapted from the PsychoPy documentation.

I’ve also tried variations of window handling as suggested by Jon (unable to provide link due to new user link restriction, but see commented lines below).

My setup:
SR Research EyeLink 1000 eyetracker
PsychoPy3 v3.2.4 (standalone, pylink package is included)
Python 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit (AMD64)] on win32
Windows 7 Laptop

# ...
from psychopy.iohub import launchHubServer
from psychopy.iohub.util import readConfig
from psychopy.core import getTime, wait

iohub_config = {'eyetracker.hw.sr_research.eyelink.EyeTracker':
                {'name': 'tracker',
                 'model_name': 'EYELINK 1000 DESKTOP',
                 'runtime_settings': {'sampling_rate': 500,
                                      'track_eyes': 'RIGHT'}
                 }
                }
io = launchHubServer(**iohub_config)

keyboard = io.devices.keyboard
mouse = io.devices.mouse

if io.getDevice('tracker'):
    eyetracker = io.devices.tracker
    
    # diagnostics
    eyetracker.setRecordingState(True)
    print('trackerTime: ', eyetracker.trackerTime())
    print('isConnected: ', eyetracker.isConnected())
    print('isRecordingEnabled: ', eyetracker.isRecordingEnabled())
    eyetracker.setRecordingState(False)
    
    tracker_config = eyetracker.getConfiguration()
    print('Tracker-Config: \n',  tracker_config)
    
    print('all EyeTracking events in 1 second:\n')
    eyetracker.setRecordingState(True)
    stime = getTime()
    while getTime()-stime < 1.0:
        for e in eyetracker.getEvents():
            print(e)
    eyetracker.setRecordingState(False)
    
    eyetracker.setRecordingState(True)
    while not keyboard.getEvents():
        core.wait(1)
        gaze_pos = eyetracker.getLastGazePosition()
        print('last gaze position: ', gaze_pos)
    eyetracker.setRecordingState(False)
    
    # win.winHandle.minimize()
    # win.winHandle.set_visible(False)
    print("All fine up to this point")
    eyetracker.runSetupProcedure()
    print("This will not print")
    # win.winHandle.activate()
    # win.winHandle.set_visible(True)
    # win.winHandle.maximize()

io.quit()

After calibration via Track.exe, the output of my test script is:

######### Running: [...]\iohub_diagnostics.py ##########
pygame 1.9.4
Hello from the pygame community. https://www.pygame.org/contribute.html
ioHub-Config: 
 {'eyetracker.hw.sr_research.eyelink.EyeTracker': {'name': 'tracker', 'enable': True, 'save_events': True, 'stream_events': True, 'device_timer': {'interval': 0.001}, 'monitor_event_types': ['MonocularEyeSampleEvent', 'BinocularEyeSampleEvent', 'FixationStartEvent', 'FixationEndEvent', 'SaccadeStartEvent', 'SaccadeEndEvent', 'BlinkStartEvent', 'BlinkEndEvent'], 'simulation_mode': False, 'enable_interface_without_connection': False, 'network_settings': '100.1.1.1', 'default_native_data_file_name': 'et_data', 'runtime_settings': {'sampling_rate': 500, 'track_eyes': 'RIGHT_EYE', 'sample_filtering': {'FILTER_ONLINE': 'FILTER_LEVEL_OFF'}, 'vog_settings': {'pupil_measure_types': 'PUPIL_DIAMETER', 'tracking_mode': 'PUPIL_CR_TRACKING', 'pupil_center_algorithm': 'CENTROID_FIT'}}, 'calibration': {'type': 'NINE_POINTS', 'auto_pace': True, 'pacing_speed': 1.5, 'screen_background_color': [128, 128, 128], 'target_type': 'CIRCLE_TARGET', 'target_attributes': {'outer_diameter': 33, 'inner_diameter': 6, 'outer_color': [255, 255, 255], 'inner_color': [0, 0, 0]}}, 'model_name': 'EYELINK 1000 DESKTOP'}, 'data_store': {'enable': True, 'experiment_info': {'code': 'ystart'}, 'session_info': {'code': 'S0001'}}}
ioHubServer started
tracker found
trackerTime:  574750.0
isConnected:  True
isRecordingEnabled:  True
Tracker-Config: 
 {'name': 'tracker', 'enable': True, 'save_events': True, 'stream_events': True, 'device_timer': {'interval': 0.001}, 'monitor_event_types': ['MonocularEyeSampleEvent', 'BinocularEyeSampleEvent', 'FixationStartEvent', 'FixationEndEvent', 'SaccadeStartEvent', 'SaccadeEndEvent', 'BlinkStartEvent', 'BlinkEndEvent'], 'simulation_mode': False, 'enable_interface_without_connection': False, 'network_settings': '100.1.1.1', 'default_native_data_file_name': 'et_data', 'runtime_settings': {'sampling_rate': 500, 'track_eyes': 'RIGHT_EYE', 'sample_filtering': {'FILTER_ONLINE': 'FILTER_LEVEL_OFF'}, 'vog_settings': {'pupil_measure_types': 'PUPIL_DIAMETER', 'tracking_mode': 'PUPIL_CR_TRACKING', 'pupil_center_algorithm': 'CENTROID_FIT'}}, 'calibration': {'type': 'NINE_POINTS', 'auto_pace': True, 'pacing_speed': 1.5, 'screen_background_color': [128, 128, 128], 'target_type': 'CIRCLE_TARGET', 'target_attributes': {'outer_diameter': 33, 'inner_diameter': 6, 'outer_color': [255, 255, 255], 'inner_color': [0, 0, 0]}}, 'model_name': 'EYELINK 1000 DESKTOP', 'auto_report_events': False, 'event_buffer_length': 1024, 'manufacturer_name': 'SR Research Ltd.', 'serial_number': 'N/A', 'manufacture_date': 'DD-MM-YYYY', 'hardware_version': 'N/A', 'firmware_version': 'N/A', 'model_number': 'N/A', 'software_version': 'N/A', 'device_number': 0}
all EyeTracking events in 1 second:

[...]
MonocularEyeSampleEventNT(experiment_id=1, session_id=2, device_id=0, event_id=570, type=51, device_time=576.767, logged_time=8.188393817133715, time=8.186393817133762, confidence_interval=0.002155785701233981, delay=0.0019999999999527063, filter_id=0, eye=22, gaze_x=-43.79998779296875, gaze_y=-73.0, gaze_z=0, eye_cam_x=0, eye_cam_y=0, eye_cam_z=0, angle_x=0.0, angle_y=0.0, raw_x=0.0, raw_y=0.0, pupil_measure1=5170.0, pupil_measure1_type=70, pupil_measure2=0, pupil_measure2_type=0, ppd_x=24.600000381469727, ppd_y=26.299999237060547, velocity_x=0, velocity_y=0, velocity_xy=0, status=0)
MonocularEyeSampleEventNT(experiment_id=1, session_id=2, device_id=0, event_id=571, type=51, device_time=576.769, logged_time=8.189256472722036, time=8.18825647272206, confidence_interval=0.0008690551105701161, delay=0.0009999999999763531, filter_id=0, eye=22, gaze_x=-44.0, gaze_y=-73.89999389648438, gaze_z=0, eye_cam_x=0, eye_cam_y=0, eye_cam_z=0, angle_x=0.0, angle_y=0.0, raw_x=0.0, raw_y=0.0, pupil_measure1=5172.0, pupil_measure1_type=70, pupil_measure2=0, pupil_measure2_type=0, ppd_x=24.600000381469727, ppd_y=26.299999237060547, velocity_x=0, velocity_y=0, velocity_xy=0, status=0)

[...]
last gaze position:  [-248.60000610351562, -175.00000000000003]
[...]
last gaze position:  [348.70001220703125, 220.39999389648438]
[...]
last gaze position:  [-317.1000061035156, 210.10000610351562]
[...]
last gaze position:  [348.0999755859375, -220.29998779296872]
[...]

All fine up to this point

Then PsychoPy freezes without an error message. If I don’t calibrate beforehand, the script still produces output, but the values are off.

I’ll attach the diagnostics script and the complete output in the first answer.

Am I missing something? Any suggestions are greatly appreciated!
Thanks in advance!

I have the exactly same issue. There is clear a bug within the iohub module of psychopy3 specifically, as the .runSetupProcedure() works in psychopy2, (but another error will be raised, to solve it see this)

I get rid of this issue by using the pylink library directly because I do not want to convert my codes to fit python2. The bug is within psychopy3 modules but not in the lower level pylink package.

2 Likes

Hi Praflux,

I am experiencing the same issue, with the eyetracker freezing after calibration, before the task is supposed to start. The following is my output:

displayAPI: init_net() start use_tcp_only=0
displayAPI: connecting
1

By using print statements in the code, I figured out that the error occurs after:
self.create_tracker(sensitivity_class=1, sample_rate=500)
But before:
self.tracker_setup(sensitivity_class=1, sample_rate=500)

Did you find a solution to this problem, or any troubleshooting tips?

We are using python 2.7 and psychopy 3.2.0 .

Any advice would be greatly appreciated.

Kind regards,
Sean van Mil