The issue maybe that waiting 2 seconds to get any events will cause the event buffer to fill up and old events to be dropped. By default only the last 1024 events are kept in memory, and this includes eye samples. So if running at 1000 hz, only the last second (ish) of data will be buffered.
Updating the simple.py demo to print start and end fixation events during the trial loop seems to be working:
# at top of script / imports
from psychopy.iohub.constants import EventConstants
# within the 'trial' loop
fstarts = tracker.getEvents(event_type_id=EventConstants.FIXATION_START)
fends = tracker.getEvents(event_type_id=EventConstants.FIXATION_END)
if fstarts:
for e in fstarts:
print(e)
if fends:
for e in fends:
print(e)
should print one line for each start / end fixation event, similar to:
FixationStartEventNT(experiment_id=0, session_id=0, device_id=0, event_id=7713, type=53, device_time=63.962, logged_time=56.450762999942526, time=56.41976299994253, confidence_interval=0.0009974001441150904, delay=0.030999999999998806, filter_id=0, eye=22, gaze_x=-33408.0, gaze_y=33280.0, gaze_z=0, angle_x=-32768.0, angle_y=-32768.0, raw_x=0, raw_y=0, pupil_measure1=32768.0, pupil_measure1_type=70, pupil_measure2=0, pupil_measure2_type=0, ppd_x=-32768.0, ppd_y=-32768.0, velocity_x=0, velocity_y=0, velocity_xy=-32768.0, status=0)
FixationEndEventNT(experiment_id=0, session_id=0, device_id=0, event_id=9706, type=54, device_time=65.96900000000001, logged_time=58.44264489994384, time=58.42664489994385, confidence_interval=0.0009652001317590475, delay=0.015999999999991132, filter_id=0, eye=22, duration=2.007000000000005, start_gaze_x=-33408.0, start_gaze_y=33280.0, start_gaze_z=0, start_angle_x=-32768.0, start_angle_y=-32768.0, start_raw_x=0, start_raw_y=0, start_pupil_measure1=32768.0, start_pupil_measure1_type=70, start_pupil_measure2=0, start_pupil_measure2_type=0, start_ppd_x=27.299999237060547, start_ppd_y=26.0, start_velocity_x=0, start_velocity_y=0, start_velocity_xy=-32768.0, end_gaze_x=-33408.0, end_gaze_y=33280.0, end_gaze_z=0, end_angle_x=-32768.0, end_angle_y=-32768.0, end_raw_x=0, end_raw_y=0, end_pupil_measure1=32768.0, end_pupil_measure1_type=70, end_pupil_measure2=0, end_pupil_measure2_type=0, end_ppd_x=27.299999237060547, end_ppd_y=26.0, end_velocity_x=0, end_velocity_y=0, end_velocity_xy=-32768.0, average_gaze_x=-469.8000030517578, average_gaze_y=99.5, average_gaze_z=0, average_angle_x=-5004.0, average_angle_y=-1059.0, average_raw_x=0, average_raw_y=0, average_pupil_measure1=1000.0, average_pupil_measure1_type=70, average_pupil_measure2=0, average_pupil_measure2_type=0, average_ppd_x=0, average_ppd_y=0, average_velocity_x=0, average_velocity_y=0, average_velocity_xy=-32768.0, peak_velocity_x=0, peak_velocity_y=0, peak_velocity_xy=-32768.0, status=0)
# .....
If you need to buffer more events, you can increase the buffer length used by the iohub device when it is configured. Currently the max number of events that can be buffered is 2048:
# Update simply.py demo config of eyelink to buffer 2048 events / samples
elif TRACKER == 'eyelink':
eyetracker_config['model_name'] = 'EYELINK 1000 DESKTOP'
eyetracker_config['event_buffer_length'] = 2048
eyetracker_config['runtime_settings'] = dict(sampling_rate=1000, track_eyes='RIGHT')
devices_config['eyetracker.hw.sr_research.eyelink.EyeTracker'] = eyetracker_config
Thank you