Tobii Pro SDK Python API
tobii_research Namespace Reference

All functionality is in this module. More...

Data Structures

class  CalibrationEyeData
 Represents the calibration sample data collected for one eye. More...
 
class  CalibrationModeEnteredData
 Provides data the EYETRACKER_NOTIFICATION_CALIBRATION_MODE_ENTERED callback. More...
 
class  CalibrationModeLeftData
 Provides data the EYETRACKER_NOTIFICATION_CALIBRATION_MODE_LEFT callback. More...
 
class  CalibrationPoint
 Represents the calibration point and its collected calibration samples. More...
 
class  CalibrationResult
 Represents the result of the calculated calibration. More...
 
class  CalibrationSample
 Represents the data collected for a calibration sample. More...
 
class  ConnectionLostData
 Provides data the EYETRACKER_NOTIFICATION_CONNECTION_LOST callback. More...
 
class  ConnectionRestoredData
 Provides data the EYETRACKER_NOTIFICATION_CONNECTION_RESTORED callback. More...
 
class  DisplayArea
 Represents the corners in space of the active display area, and its size. More...
 
class  DisplayAreaChangedData
 Provides data the EYETRACKER_NOTIFICATION_DISPLAY_AREA_CHANGED callback. More...
 
class  ExternalSignalData
 Provides data for external signal. More...
 
class  EyeData
 Provides properties for the eye data. More...
 
class  EyeImageData
 Provides data for the eye image callback. More...
 
class  EyeTracker
 Provides methods and properties to manage and get data from an eye tracker. More...
 
class  EyeTrackerConnectionFailedError
 Is thrown when connection to an eye tracker is lost or could not be established. More...
 
class  EyeTrackerDisplayAreaNotValidError
 Is thrown if the display area isn't valid. More...
 
class  EyeTrackerFeatureNotSupportedError
 Is thrown when a feature is not supported for an eye tracker. More...
 
class  EyeTrackerInternalError
 Is thrown on internal errors in the API. More...
 
class  EyeTrackerInvalidOperationError
 Is thrown when the user tries to do an invalid operation. More...
 
class  EyeTrackerLicenseError
 Is thrown when there is an insufficient license level when using a restricted feature. More...
 
class  EyeTrackerOperationFailedError
 Is thrown when an eye tracker cannot execute a requested operation. More...
 
class  EyeTrackerSavedLicenseFailedToApplyError
 Is thrown if the eye tracker has a license saved, but it failed to apply. More...
 
class  EyeTrackerUnavailableError
 Is thrown if the eye tracker is unavailable. More...
 
class  FailedLicense
 Represents a license that failed. More...
 
class  GazeData
 Provides data for gaze. More...
 
class  GazeOrigin
 Provides properties for the gaze origin. More...
 
class  GazeOutputFrequencyChangedData
 Provides data the EYETRACKER_NOTIFICATION_GAZE_OUTPUT_FREQUENCY_CHANGED callback. More...
 
class  GazePoint
 Provides properties for the gaze point. More...
 
class  LicenseKey
 Represents the eye tracker license key. More...
 
class  PupilData
 Provides properties for the pupil data. More...
 
class  ScreenBasedCalibration
 Provides methods and properties for managing calibrations for screen based eye trackers. More...
 
class  StreamErrorData
 Provides information about a stream error. More...
 
class  TimeSynchronizationData
 Provides data for the time synchronization callback. More...
 
class  TrackBox
 Represents the eight corners in user coordinate system that together forms the track box. More...
 
class  TrackBoxChangedData
 Provides data the EYETRACKER_NOTIFICATION_TRACK_BOX_CHANGED callback. More...
 

Functions

def find_all_eyetrackers ()
 Finds eye trackers connected to the computer or the network. More...
 
def get_system_time_stamp ()
 Retrieves the time stamp from the system clock in microseconds. More...
 

Variables

string EXTERNAL_SIGNAL_CHANGE_TYPE_VALUE_CHANGED = "external_signal_change_type_value_changed"
 Indicates that the value sent to the eye tracker has changed. More...
 
string EXTERNAL_SIGNAL_CHANGE_TYPE_INITIAL_VALUE = "external_signal_change_type_initial_value"
 Indicates that the value is the initial value, and is received when starting a subscription. More...
 
string EXTERNAL_SIGNAL_CHANGE_TYPE_CONNECTION_RESTORED = "external_signal_change_type_connection_restored"
 Indicates that there has been a connection lost and now it is restored and the value is the current value. More...
 
string EYE_IMAGE_TYPE_FULL = "eye_image_type_full"
 Indicates that the eye tracker could not identify the eyes, and the image is the full image. More...
 
string EYE_IMAGE_TYPE_CROPPED = "eye_image_type_cropped"
 Indicates that the image is cropped and shows the eyes. More...
 
string EYE_IMAGE_TYPE_UNKNOWN = "eye_image_type_unknown"
 Indicates an unknown image type. More...
 
string CAPABILITY_CAN_SET_DISPLAY_AREA = "capability_can_set_display_area"
 Indicates that the device can have display areas set. More...
 
string CAPABILITY_HAS_EXTERNAL_SIGNAL = "capability_has_external_signal"
 Indicates that the device can deliver an external signal stream. More...
 
string CAPABILITY_HAS_EYE_IMAGES = "capability_has_eye_images"
 Indicates that the device can deliver an eye image stream. More...
 
string EYETRACKER_EXTERNAL_SIGNAL = "eyetracker_external_signal"
 Used in EyeTracker.subscribe_to and EyeTracker.unsubscribe_from for external signal. More...
 
string EYETRACKER_EYE_IMAGES = "eyetracker_eye_images"
 Used in EyeTracker.subscribe_to and EyeTracker.unsubscribe_from for eye images. More...
 
string EYETRACKER_GAZE_DATA = "eyetracker_gaze_data"
 Used in EyeTracker.subscribe_to and EyeTracker.unsubscribe_from for gaze data. More...
 
string EYETRACKER_NOTIFICATION_CALIBRATION_MODE_ENTERED = "eyetracker_notification_calibration_mode_entered"
 Used in EyeTracker.subscribe_to and EyeTracker.unsubscribe_from for calibration mode entered messages. More...
 
string EYETRACKER_NOTIFICATION_CALIBRATION_MODE_LEFT = "eyetracker_notification_calibration_mode_left"
 Used in EyeTracker.subscribe_to and EyeTracker.unsubscribe_from for calibration mode left messages. More...
 
string EYETRACKER_NOTIFICATION_CONNECTION_LOST = "eyetracker_notification_connection_lost"
 Used in EyeTracker.subscribe_to and EyeTracker.unsubscribe_from for connection lost messages. More...
 
string EYETRACKER_NOTIFICATION_CONNECTION_RESTORED = "eyetracker_notification_connection_restored"
 Used in EyeTracker.subscribe_to and EyeTracker.unsubscribe_from for connection restored messages. More...
 
string EYETRACKER_NOTIFICATION_DISPLAY_AREA_CHANGED = "eyetracker_notification_display_area_changed"
 Used in EyeTracker.subscribe_to and EyeTracker.unsubscribe_from for display area changed messages. More...
 
string EYETRACKER_NOTIFICATION_GAZE_OUTPUT_FREQUENCY_CHANGED = "eyetracker_notification_gaze_output_frequency_changed"
 Used in EyeTracker.subscribe_to and EyeTracker.unsubscribe_from for gaze output frequency changed messages. More...
 
string EYETRACKER_NOTIFICATION_TRACK_BOX_CHANGED = "eyetracker_notification_track_box_changed"
 Used in EyeTracker.subscribe_to and EyeTracker.unsubscribe_from for track box changed messages. More...
 
string EYETRACKER_STREAM_ERRORS = "eyetracker_stream_errors"
 Used in EyeTracker.subscribe_to and EyeTracker.unsubscribe_from for stream errors. More...
 
string EYETRACKER_TIME_SYNCHRONIZATION_DATA = "eyetracker_time_synchronization_data"
 Used in EyeTracker.subscribe_to and EyeTracker.unsubscribe_from for time synchronization data. More...
 
string LICENSE_TAMPERED = "license_tampered"
 The license is tampered. More...
 
string LICENSE_INVALID_APPLICATION_SIGNATURE = "license_invalid_application_signature"
 The application signature is invalid. More...
 
string LICENSE_NONSIGNED_APPLICATION = "license_nonsigned_application"
 The application has not been signed. More...
 
string LICENSE_EXPIRED = "license_expired"
 The license has expired. More...
 
string LICENSE_PREMATURE = "license_premature"
 The license is not yet valid. More...
 
string LICENSE_INVALID_PROCESS_NAME = "license_invalid_process_name"
 The process name does not match the license. More...
 
string LICENSE_INVALID_SERIAL_NUMBER = "license_invalid_serial_number"
 The serial number does not match the license. More...
 
string LICENSE_INVALID_MODEL = "license_invalid_model"
 The model does not match the license. More...
 
string LICENSE_UNKNOWN_ERROR = "license_unknown_error"
 The license validation returned an unexpected result. More...
 
string CALIBRATION_STATUS_FAILURE = "calibration_status_failure"
 Indicates that the calibration process failed. More...
 
string CALIBRATION_STATUS_SUCCESS = "calibration_status_success"
 Indicates that the calibration process succeeded. More...
 
string VALIDITY_INVALID_AND_NOT_USED = "validity_invalid_and_not_used"
 The eye tracking failed or the calibration eye data is invalid. More...
 
string VALIDITY_VALID_BUT_NOT_USED = "validity_valid_but_not_used"
 Eye tracking was successful, but the calibration eye data was not used in calibration e.g. More...
 
string VALIDITY_VALID_AND_USED = "validity_valid_and_used"
 The calibration eye data was valid and used in calibration. More...
 

Detailed Description

All functionality is in this module.

Function Documentation

def tobii_research.find_all_eyetrackers ( )

Finds eye trackers connected to the computer or the network.

Please note that subsequent calls to find_all_eyetrackers() may return the eye trackers in a different order.

1 import tobii_research as tr
2 
3 eyetrackers = tr.find_all_eyetrackers()
4 
5 for eyetracker in eyetrackers:
6  print("Address: " + eyetracker.address)
7  print("Model: " + eyetracker.model)
8  print("Name (It's OK if this is empty): " + eyetracker.device_name)
9  print("Serial number: " + eyetracker.serial_number)
Exceptions
EyeTrackerInternalError
Returns
A tuple of EyeTracker objects found.
def tobii_research.get_system_time_stamp ( )

Retrieves the time stamp from the system clock in microseconds.

1 import tobii_research as tr
2 
3 system_time_stamp = tr.get_system_time_stamp()
4 
5 print("The system time stamp in microseconds is {0}.".format(system_time_stamp))
Exceptions
EyeTrackerInternalError

Variable Documentation

string tobii_research.CALIBRATION_STATUS_FAILURE = "calibration_status_failure"

Indicates that the calibration process failed.

Value for CalibrationResult.status and return value of ScreenBasedCalibration.collect_data

string tobii_research.CALIBRATION_STATUS_SUCCESS = "calibration_status_success"

Indicates that the calibration process succeeded.

Value for CalibrationResult.status and return value of ScreenBasedCalibration.collect_data

string tobii_research.CAPABILITY_CAN_SET_DISPLAY_AREA = "capability_can_set_display_area"

Indicates that the device can have display areas set.

Value in tuple EyeTracker.device_capabilities

1 import tobii_research as tr
2 
3 # address = "tet-tcp://12.13.14.15"
4 eyetracker = tr.EyeTracker(address)
5 
6 print("Address: " + eyetracker.address)
7 print("Model: " + eyetracker.model)
8 print("Name (It's OK if this is empty): " + eyetracker.device_name)
9 print("Serial number: " + eyetracker.serial_number)
10 
11 if tr.CAPABILITY_CAN_SET_DISPLAY_AREA in eyetracker.device_capabilities:
12  print("The display area can be set on the eye tracker.")
13 else:
14  print("The display area can not be set on the eye tracker.")
15 
16 if tr.CAPABILITY_HAS_EXTERNAL_SIGNAL in eyetracker.device_capabilities:
17  print("The eye tracker can deliver an external signal stream.")
18 else:
19  print("The eye tracker can not deliver an external signal stream.")
20 
21 if tr.CAPABILITY_HAS_EYE_IMAGES in eyetracker.device_capabilities:
22  print("The eye tracker can deliver an eye image stream.")
23 else:
24  print("The eye tracker can not deliver an eye image stream.")
string tobii_research.CAPABILITY_HAS_EXTERNAL_SIGNAL = "capability_has_external_signal"

Indicates that the device can deliver an external signal stream.

Value in tuple EyeTracker.device_capabilities

1 import tobii_research as tr
2 
3 # address = "tet-tcp://12.13.14.15"
4 eyetracker = tr.EyeTracker(address)
5 
6 print("Address: " + eyetracker.address)
7 print("Model: " + eyetracker.model)
8 print("Name (It's OK if this is empty): " + eyetracker.device_name)
9 print("Serial number: " + eyetracker.serial_number)
10 
11 if tr.CAPABILITY_CAN_SET_DISPLAY_AREA in eyetracker.device_capabilities:
12  print("The display area can be set on the eye tracker.")
13 else:
14  print("The display area can not be set on the eye tracker.")
15 
16 if tr.CAPABILITY_HAS_EXTERNAL_SIGNAL in eyetracker.device_capabilities:
17  print("The eye tracker can deliver an external signal stream.")
18 else:
19  print("The eye tracker can not deliver an external signal stream.")
20 
21 if tr.CAPABILITY_HAS_EYE_IMAGES in eyetracker.device_capabilities:
22  print("The eye tracker can deliver an eye image stream.")
23 else:
24  print("The eye tracker can not deliver an eye image stream.")
string tobii_research.CAPABILITY_HAS_EYE_IMAGES = "capability_has_eye_images"

Indicates that the device can deliver an eye image stream.

Value in tuple EyeTracker.device_capabilities

1 import tobii_research as tr
2 
3 # address = "tet-tcp://12.13.14.15"
4 eyetracker = tr.EyeTracker(address)
5 
6 print("Address: " + eyetracker.address)
7 print("Model: " + eyetracker.model)
8 print("Name (It's OK if this is empty): " + eyetracker.device_name)
9 print("Serial number: " + eyetracker.serial_number)
10 
11 if tr.CAPABILITY_CAN_SET_DISPLAY_AREA in eyetracker.device_capabilities:
12  print("The display area can be set on the eye tracker.")
13 else:
14  print("The display area can not be set on the eye tracker.")
15 
16 if tr.CAPABILITY_HAS_EXTERNAL_SIGNAL in eyetracker.device_capabilities:
17  print("The eye tracker can deliver an external signal stream.")
18 else:
19  print("The eye tracker can not deliver an external signal stream.")
20 
21 if tr.CAPABILITY_HAS_EYE_IMAGES in eyetracker.device_capabilities:
22  print("The eye tracker can deliver an eye image stream.")
23 else:
24  print("The eye tracker can not deliver an eye image stream.")
string tobii_research.EXTERNAL_SIGNAL_CHANGE_TYPE_CONNECTION_RESTORED = "external_signal_change_type_connection_restored"

Indicates that there has been a connection lost and now it is restored and the value is the current value.

Value for ExternalSignalData.change_type

string tobii_research.EXTERNAL_SIGNAL_CHANGE_TYPE_INITIAL_VALUE = "external_signal_change_type_initial_value"

Indicates that the value is the initial value, and is received when starting a subscription.

Value for ExternalSignalData.change_type

string tobii_research.EXTERNAL_SIGNAL_CHANGE_TYPE_VALUE_CHANGED = "external_signal_change_type_value_changed"

Indicates that the value sent to the eye tracker has changed.

Value for ExternalSignalData.change_type

string tobii_research.EYE_IMAGE_TYPE_CROPPED = "eye_image_type_cropped"

Indicates that the image is cropped and shows the eyes.

Value for EyeImageData.image_type

string tobii_research.EYE_IMAGE_TYPE_FULL = "eye_image_type_full"

Indicates that the eye tracker could not identify the eyes, and the image is the full image.

Value for EyeImageData.image_type

string tobii_research.EYE_IMAGE_TYPE_UNKNOWN = "eye_image_type_unknown"

Indicates an unknown image type.

Value for EyeImageData.image_type

string tobii_research.EYETRACKER_EXTERNAL_SIGNAL = "eyetracker_external_signal"

Used in EyeTracker.subscribe_to and EyeTracker.unsubscribe_from for external signal.

You will get a callback when the value of the external signal port (TTL input) on the eye tracker device changes. Not all eye trackers have an output trigger port. The output feature could be used to synchronize the eye tracker data with data from other devices. The output data contains a time reference that matches the time reference on the time synchronized gaze data. Callbacks will receive an ExternalSignalData object or a dictionary with values if as_dictionary is True. See find_all_eyetrackers or EyeTracker.__init__ on how to create an EyeTracker object.

1 import time
2 import tobii_research as tobii_eyetracking
3 
4 
5 def external_signal_callback(external_signal_data):
6  print external_signal_data
7 
8 
9 def external_signal(eyetracker):
10  print "Subscribing to external signal for eye tracker with serial number {0}.".format(eyetracker.serial_number)
11  eyetracker.subscribe_to(tobii_eyetracking.EYETRACKER_EXTERNAL_SIGNAL, external_signal_callback, as_dictionary=True)
12 
13  # Wait for external signal.
14  time.sleep(2)
15 
16  eyetracker.unsubscribe_from(tobii_eyetracking.EYETRACKER_EXTERNAL_SIGNAL, external_signal_callback)
17  print "Unsubscribed from external signal."
string tobii_research.EYETRACKER_EYE_IMAGES = "eyetracker_eye_images"

Used in EyeTracker.subscribe_to and EyeTracker.unsubscribe_from for eye images.

You will get a callback when a new eye image is received, and the occurrence depends on the eye tracker model. Not all eye tracker models support this feature. If no one is listening to gaze data, the eye tracker will only deliver full images, otherwise either cropped or full images will be delivered depending on whether or not the eye tracker has detected eyes. Callbacks will receive an EyeImageData object or a dictionary with values if as_dictionary is True.

string tobii_research.EYETRACKER_GAZE_DATA = "eyetracker_gaze_data"

Used in EyeTracker.subscribe_to and EyeTracker.unsubscribe_from for gaze data.

You will get a callback when time synchronized gaze is received. Time synchronized gaze is not supported on all eye trackers, other eye trackers need additional license to activate this support. Callbacks will receive a GazeData object or a dictionary with values if as_dictionary is True. See find_all_eyetrackers or EyeTracker.__init__ on how to create an EyeTracker object.

1 import time
2 import tobii_research as tobii_eyetracking
3 
4 global_gaze_data = None
5 
6 
7 def gaze_data_callback(gaze_data):
8  global global_gaze_data
9  global_gaze_data = gaze_data
10 
11 
12 def gaze_data(eyetracker):
13  global global_gaze_data
14 
15  print "Subscribing to gaze data for eye tracker with serial number {0}.".format(eyetracker.serial_number)
16  eyetracker.subscribe_to(tobii_eyetracking.EYETRACKER_GAZE_DATA, gaze_data_callback, as_dictionary=True)
17 
18  # Wait while some gaze data is collected.
19  time.sleep(2)
20 
21  eyetracker.unsubscribe_from(tobii_eyetracking.EYETRACKER_GAZE_DATA, gaze_data_callback)
22  print "Unsubscribed from gaze data."
23 
24  print "Last received gaze package:"
25  print global_gaze_data
string tobii_research.EYETRACKER_NOTIFICATION_CALIBRATION_MODE_ENTERED = "eyetracker_notification_calibration_mode_entered"

Used in EyeTracker.subscribe_to and EyeTracker.unsubscribe_from for calibration mode entered messages.

You will get a callback when calibration mode is entered. Callbacks will receive a CalibrationModeEnteredData object or a dictionary with values if as_dictionary is True. See find_all_eyetrackers or EyeTracker.__init__ on how to create an EyeTracker object.

1 import tobii_research as tr
2 
3 
4 def notification_callback(notification, data):
5  print "Notification {0} received at time stamp {1}.".format(notification, data.system_time_stamp)
6 
7 
8 def notifications(eyetracker):
9  all_notifications =\
10  (tr.EYETRACKER_NOTIFICATION_CONNECTION_LOST,
11  tr.EYETRACKER_NOTIFICATION_CONNECTION_RESTORED,
12  tr.EYETRACKER_NOTIFICATION_CALIBRATION_MODE_ENTERED,
13  tr.EYETRACKER_NOTIFICATION_CALIBRATION_MODE_LEFT,
14  tr.EYETRACKER_NOTIFICATION_TRACK_BOX_CHANGED,
15  tr.EYETRACKER_NOTIFICATION_DISPLAY_AREA_CHANGED,
16  tr.EYETRACKER_NOTIFICATION_GAZE_OUTPUT_FREQUENCY_CHANGED)
17 
18  # Subscribe to all notifications.
19  for notification in all_notifications:
20  eyetracker.subscribe_to(notification,
21  lambda x, notification=notification: notification_callback(notification, x))
22  print "Subscribed to {0} for eye tracker with serial number {1}.".format(notification, eyetracker.serial_number)
23 
24  # Trigger some notifications
25  calibration = tr.ScreenBasedCalibration(eyetracker)
26 
27  calibration.enter_calibration_mode()
28 
29  calibration.leave_calibration_mode()
30 
31  # Unsubscribe from notifications.
32  for notification in all_notifications:
33  eyetracker.unsubscribe_from(notification)
34  print "Unsubscribed from {0}.".format(notification)
string tobii_research.EYETRACKER_NOTIFICATION_CALIBRATION_MODE_LEFT = "eyetracker_notification_calibration_mode_left"

Used in EyeTracker.subscribe_to and EyeTracker.unsubscribe_from for calibration mode left messages.

You will get a callback when calibration mode is left. Callbacks will receive a CalibrationModeLeftData object or a dictionary with values if as_dictionary is True. See find_all_eyetrackers or EyeTracker.__init__ on how to create an EyeTracker object.

1 import tobii_research as tr
2 
3 
4 def notification_callback(notification, data):
5  print "Notification {0} received at time stamp {1}.".format(notification, data.system_time_stamp)
6 
7 
8 def notifications(eyetracker):
9  all_notifications =\
10  (tr.EYETRACKER_NOTIFICATION_CONNECTION_LOST,
11  tr.EYETRACKER_NOTIFICATION_CONNECTION_RESTORED,
12  tr.EYETRACKER_NOTIFICATION_CALIBRATION_MODE_ENTERED,
13  tr.EYETRACKER_NOTIFICATION_CALIBRATION_MODE_LEFT,
14  tr.EYETRACKER_NOTIFICATION_TRACK_BOX_CHANGED,
15  tr.EYETRACKER_NOTIFICATION_DISPLAY_AREA_CHANGED,
16  tr.EYETRACKER_NOTIFICATION_GAZE_OUTPUT_FREQUENCY_CHANGED)
17 
18  # Subscribe to all notifications.
19  for notification in all_notifications:
20  eyetracker.subscribe_to(notification,
21  lambda x, notification=notification: notification_callback(notification, x))
22  print "Subscribed to {0} for eye tracker with serial number {1}.".format(notification, eyetracker.serial_number)
23 
24  # Trigger some notifications
25  calibration = tr.ScreenBasedCalibration(eyetracker)
26 
27  calibration.enter_calibration_mode()
28 
29  calibration.leave_calibration_mode()
30 
31  # Unsubscribe from notifications.
32  for notification in all_notifications:
33  eyetracker.unsubscribe_from(notification)
34  print "Unsubscribed from {0}.".format(notification)
string tobii_research.EYETRACKER_NOTIFICATION_CONNECTION_LOST = "eyetracker_notification_connection_lost"

Used in EyeTracker.subscribe_to and EyeTracker.unsubscribe_from for connection lost messages.

You will get a callback when connection to the eye tracker is lost. Callbacks will receive a ConnectionLostData object or a dictionary with values if as_dictionary is True. See find_all_eyetrackers or EyeTracker.__init__ on how to create an EyeTracker object.

1 import tobii_research as tr
2 
3 
4 def notification_callback(notification, data):
5  print "Notification {0} received at time stamp {1}.".format(notification, data.system_time_stamp)
6 
7 
8 def notifications(eyetracker):
9  all_notifications =\
10  (tr.EYETRACKER_NOTIFICATION_CONNECTION_LOST,
11  tr.EYETRACKER_NOTIFICATION_CONNECTION_RESTORED,
12  tr.EYETRACKER_NOTIFICATION_CALIBRATION_MODE_ENTERED,
13  tr.EYETRACKER_NOTIFICATION_CALIBRATION_MODE_LEFT,
14  tr.EYETRACKER_NOTIFICATION_TRACK_BOX_CHANGED,
15  tr.EYETRACKER_NOTIFICATION_DISPLAY_AREA_CHANGED,
16  tr.EYETRACKER_NOTIFICATION_GAZE_OUTPUT_FREQUENCY_CHANGED)
17 
18  # Subscribe to all notifications.
19  for notification in all_notifications:
20  eyetracker.subscribe_to(notification,
21  lambda x, notification=notification: notification_callback(notification, x))
22  print "Subscribed to {0} for eye tracker with serial number {1}.".format(notification, eyetracker.serial_number)
23 
24  # Trigger some notifications
25  calibration = tr.ScreenBasedCalibration(eyetracker)
26 
27  calibration.enter_calibration_mode()
28 
29  calibration.leave_calibration_mode()
30 
31  # Unsubscribe from notifications.
32  for notification in all_notifications:
33  eyetracker.unsubscribe_from(notification)
34  print "Unsubscribed from {0}.".format(notification)
string tobii_research.EYETRACKER_NOTIFICATION_CONNECTION_RESTORED = "eyetracker_notification_connection_restored"

Used in EyeTracker.subscribe_to and EyeTracker.unsubscribe_from for connection restored messages.

You will get a callback when connection to the eye tracker is restored. Callbacks will receive a ConnectionRestoredData object or a dictionary with values if as_dictionary is True. See find_all_eyetrackers or EyeTracker.__init__ on how to create an EyeTracker object.

1 import tobii_research as tr
2 
3 
4 def notification_callback(notification, data):
5  print "Notification {0} received at time stamp {1}.".format(notification, data.system_time_stamp)
6 
7 
8 def notifications(eyetracker):
9  all_notifications =\
10  (tr.EYETRACKER_NOTIFICATION_CONNECTION_LOST,
11  tr.EYETRACKER_NOTIFICATION_CONNECTION_RESTORED,
12  tr.EYETRACKER_NOTIFICATION_CALIBRATION_MODE_ENTERED,
13  tr.EYETRACKER_NOTIFICATION_CALIBRATION_MODE_LEFT,
14  tr.EYETRACKER_NOTIFICATION_TRACK_BOX_CHANGED,
15  tr.EYETRACKER_NOTIFICATION_DISPLAY_AREA_CHANGED,
16  tr.EYETRACKER_NOTIFICATION_GAZE_OUTPUT_FREQUENCY_CHANGED)
17 
18  # Subscribe to all notifications.
19  for notification in all_notifications:
20  eyetracker.subscribe_to(notification,
21  lambda x, notification=notification: notification_callback(notification, x))
22  print "Subscribed to {0} for eye tracker with serial number {1}.".format(notification, eyetracker.serial_number)
23 
24  # Trigger some notifications
25  calibration = tr.ScreenBasedCalibration(eyetracker)
26 
27  calibration.enter_calibration_mode()
28 
29  calibration.leave_calibration_mode()
30 
31  # Unsubscribe from notifications.
32  for notification in all_notifications:
33  eyetracker.unsubscribe_from(notification)
34  print "Unsubscribed from {0}.".format(notification)
string tobii_research.EYETRACKER_NOTIFICATION_DISPLAY_AREA_CHANGED = "eyetracker_notification_display_area_changed"

Used in EyeTracker.subscribe_to and EyeTracker.unsubscribe_from for display area changed messages.

You will get a callback when the display area is changed. Callbacks will receive a DisplayAreaChangedData object or a dictionary with values if as_dictionary is True. See find_all_eyetrackers or EyeTracker.__init__ on how to create an EyeTracker object.

1 import tobii_research as tr
2 
3 
4 def notification_callback(notification, data):
5  print "Notification {0} received at time stamp {1}.".format(notification, data.system_time_stamp)
6 
7 
8 def notifications(eyetracker):
9  all_notifications =\
10  (tr.EYETRACKER_NOTIFICATION_CONNECTION_LOST,
11  tr.EYETRACKER_NOTIFICATION_CONNECTION_RESTORED,
12  tr.EYETRACKER_NOTIFICATION_CALIBRATION_MODE_ENTERED,
13  tr.EYETRACKER_NOTIFICATION_CALIBRATION_MODE_LEFT,
14  tr.EYETRACKER_NOTIFICATION_TRACK_BOX_CHANGED,
15  tr.EYETRACKER_NOTIFICATION_DISPLAY_AREA_CHANGED,
16  tr.EYETRACKER_NOTIFICATION_GAZE_OUTPUT_FREQUENCY_CHANGED)
17 
18  # Subscribe to all notifications.
19  for notification in all_notifications:
20  eyetracker.subscribe_to(notification,
21  lambda x, notification=notification: notification_callback(notification, x))
22  print "Subscribed to {0} for eye tracker with serial number {1}.".format(notification, eyetracker.serial_number)
23 
24  # Trigger some notifications
25  calibration = tr.ScreenBasedCalibration(eyetracker)
26 
27  calibration.enter_calibration_mode()
28 
29  calibration.leave_calibration_mode()
30 
31  # Unsubscribe from notifications.
32  for notification in all_notifications:
33  eyetracker.unsubscribe_from(notification)
34  print "Unsubscribed from {0}.".format(notification)
string tobii_research.EYETRACKER_NOTIFICATION_GAZE_OUTPUT_FREQUENCY_CHANGED = "eyetracker_notification_gaze_output_frequency_changed"

Used in EyeTracker.subscribe_to and EyeTracker.unsubscribe_from for gaze output frequency changed messages.

You will get a callback when the gaze output frequency is changed. Callbacks will receive a GazeOutputFrequencyChangedData object or a dictionary with values if as_dictionary is True. See find_all_eyetrackers or EyeTracker.__init__ on how to create an EyeTracker object.

1 import tobii_research as tr
2 
3 
4 def notification_callback(notification, data):
5  print "Notification {0} received at time stamp {1}.".format(notification, data.system_time_stamp)
6 
7 
8 def notifications(eyetracker):
9  all_notifications =\
10  (tr.EYETRACKER_NOTIFICATION_CONNECTION_LOST,
11  tr.EYETRACKER_NOTIFICATION_CONNECTION_RESTORED,
12  tr.EYETRACKER_NOTIFICATION_CALIBRATION_MODE_ENTERED,
13  tr.EYETRACKER_NOTIFICATION_CALIBRATION_MODE_LEFT,
14  tr.EYETRACKER_NOTIFICATION_TRACK_BOX_CHANGED,
15  tr.EYETRACKER_NOTIFICATION_DISPLAY_AREA_CHANGED,
16  tr.EYETRACKER_NOTIFICATION_GAZE_OUTPUT_FREQUENCY_CHANGED)
17 
18  # Subscribe to all notifications.
19  for notification in all_notifications:
20  eyetracker.subscribe_to(notification,
21  lambda x, notification=notification: notification_callback(notification, x))
22  print "Subscribed to {0} for eye tracker with serial number {1}.".format(notification, eyetracker.serial_number)
23 
24  # Trigger some notifications
25  calibration = tr.ScreenBasedCalibration(eyetracker)
26 
27  calibration.enter_calibration_mode()
28 
29  calibration.leave_calibration_mode()
30 
31  # Unsubscribe from notifications.
32  for notification in all_notifications:
33  eyetracker.unsubscribe_from(notification)
34  print "Unsubscribed from {0}.".format(notification)
string tobii_research.EYETRACKER_NOTIFICATION_TRACK_BOX_CHANGED = "eyetracker_notification_track_box_changed"

Used in EyeTracker.subscribe_to and EyeTracker.unsubscribe_from for track box changed messages.

You will get a callback when the track box is changed. Callbacks will receive a TrackBoxChangedData object or a dictionary with values if as_dictionary is True. See find_all_eyetrackers or EyeTracker.__init__ on how to create an EyeTracker object.

1 import tobii_research as tr
2 
3 
4 def notification_callback(notification, data):
5  print "Notification {0} received at time stamp {1}.".format(notification, data.system_time_stamp)
6 
7 
8 def notifications(eyetracker):
9  all_notifications =\
10  (tr.EYETRACKER_NOTIFICATION_CONNECTION_LOST,
11  tr.EYETRACKER_NOTIFICATION_CONNECTION_RESTORED,
12  tr.EYETRACKER_NOTIFICATION_CALIBRATION_MODE_ENTERED,
13  tr.EYETRACKER_NOTIFICATION_CALIBRATION_MODE_LEFT,
14  tr.EYETRACKER_NOTIFICATION_TRACK_BOX_CHANGED,
15  tr.EYETRACKER_NOTIFICATION_DISPLAY_AREA_CHANGED,
16  tr.EYETRACKER_NOTIFICATION_GAZE_OUTPUT_FREQUENCY_CHANGED)
17 
18  # Subscribe to all notifications.
19  for notification in all_notifications:
20  eyetracker.subscribe_to(notification,
21  lambda x, notification=notification: notification_callback(notification, x))
22  print "Subscribed to {0} for eye tracker with serial number {1}.".format(notification, eyetracker.serial_number)
23 
24  # Trigger some notifications
25  calibration = tr.ScreenBasedCalibration(eyetracker)
26 
27  calibration.enter_calibration_mode()
28 
29  calibration.leave_calibration_mode()
30 
31  # Unsubscribe from notifications.
32  for notification in all_notifications:
33  eyetracker.unsubscribe_from(notification)
34  print "Unsubscribed from {0}.".format(notification)
string tobii_research.EYETRACKER_STREAM_ERRORS = "eyetracker_stream_errors"

Used in EyeTracker.subscribe_to and EyeTracker.unsubscribe_from for stream errors.

You will get a callback when an error occurs on other streams. You can get errors when subscribing, when something happened to the connection in the stream pump or when an error was raised in a callback. Callbacks will receive a StreamErrorData object or a dictionary with values if as_dictionary is True.

string tobii_research.EYETRACKER_TIME_SYNCHRONIZATION_DATA = "eyetracker_time_synchronization_data"

Used in EyeTracker.subscribe_to and EyeTracker.unsubscribe_from for time synchronization data.

You will get a callback when the computer and the eye trackers clocks gets synchronized. To handle normal drifts between clocks the clocks are checked on regular basis, and this results in that the time stamps are adjusted for the drifts in the data streams. This drift handling is done in real time. The data received from this event could be used for an even more accurate drift adjustment in the post processing. Callbacks will receive a TimeSynchronizationData object or a dictionary with values if as_dictionary is True. See find_all_eyetrackers or EyeTracker.__init__ on how to create an EyeTracker object.

1 import time
2 import tobii_research as tobii_eyetracking
3 
4 
5 def time_synchronization_data_callback(time_synchronization_data):
6  print time_synchronization_data
7 
8 
9 def time_synchronization_data(eyetracker):
10  print "Subscribing to time synchronization data for eye tracker with serial number {0}.".\
11  format(eyetracker.serial_number)
12  eyetracker.subscribe_to(tobii_eyetracking.EYETRACKER_TIME_SYNCHRONIZATION_DATA,
13  time_synchronization_data_callback, as_dictionary=True)
14 
15  # Wait while some time synchronization data is collected.
16  time.sleep(2)
17 
18  eyetracker.unsubscribe_from(tobii_eyetracking.EYETRACKER_TIME_SYNCHRONIZATION_DATA,
19  time_synchronization_data_callback)
20  print "Unsubscribed from time synchronization data."
string tobii_research.LICENSE_EXPIRED = "license_expired"

The license has expired.

Value for FailedLicense.validation_result

string tobii_research.LICENSE_INVALID_APPLICATION_SIGNATURE = "license_invalid_application_signature"

The application signature is invalid.

Value for FailedLicense.validation_result

string tobii_research.LICENSE_INVALID_MODEL = "license_invalid_model"

The model does not match the license.

Value for FailedLicense.validation_result

string tobii_research.LICENSE_INVALID_PROCESS_NAME = "license_invalid_process_name"

The process name does not match the license.

Value for FailedLicense.validation_result

string tobii_research.LICENSE_INVALID_SERIAL_NUMBER = "license_invalid_serial_number"

The serial number does not match the license.

Value for FailedLicense.validation_result

string tobii_research.LICENSE_NONSIGNED_APPLICATION = "license_nonsigned_application"

The application has not been signed.

Value for FailedLicense.validation_result

string tobii_research.LICENSE_PREMATURE = "license_premature"

The license is not yet valid.

Value for FailedLicense.validation_result

string tobii_research.LICENSE_TAMPERED = "license_tampered"

The license is tampered.

Value for FailedLicense.validation_result

string tobii_research.LICENSE_UNKNOWN_ERROR = "license_unknown_error"

The license validation returned an unexpected result.

Value for FailedLicense.validation_result

string tobii_research.VALIDITY_INVALID_AND_NOT_USED = "validity_invalid_and_not_used"

The eye tracking failed or the calibration eye data is invalid.

Value for CalibrationEyeData.validity

string tobii_research.VALIDITY_VALID_AND_USED = "validity_valid_and_used"

The calibration eye data was valid and used in calibration.

Value for CalibrationEyeData.validity

string tobii_research.VALIDITY_VALID_BUT_NOT_USED = "validity_valid_but_not_used"

Eye tracking was successful, but the calibration eye data was not used in calibration e.g.

gaze was too far away. Value for CalibrationEyeData.validity