ETracker.load_calibration

ETracker.load_calibration(
    filename=None,
    use_gui=False,
    screen=-1,
    alwaysOnTop=True,
)

Loads calibration data from a file and applies it to the eye tracker.

This method allows reusing a previously saved calibration, which can save significant time for participants, especially in multi-session studies. The calibration data must be a binary file generated by a Tobii eye tracker, typically via the save_calibration() method. This operation is only available when connected to a physical eye tracker.

Parameters

Name Type Description Default
filename str The path to the calibration data file (e.g., “subject_01_calib.dat”). If use_gui is True, this path is used as the default suggestion in the file dialog. If use_gui is False, this parameter is required. None
use_gui bool If True, a graphical file-open dialog is displayed for the user to select the calibration file. Defaults to False. False
screen int Screen number where the GUI dialog is displayed. Only used when use_gui=True. If -1 (default), the dialog appears on the primary screen. Use 0, 1, 2, etc. to specify other monitors. Ignored when use_gui=False. -1
alwaysOnTop bool Whether the GUI dialog stays on top of other windows. Only used when use_gui=True. Default is True to prevent the dialog from being hidden behind experiment windows. Ignored when use_gui=False. True

Returns

Name Type Description
bool Returns True if the calibration was successfully loaded and applied, and False otherwise (e.g., user cancelled the dialog, file not found, or data was invalid).

Raises

Type Description
RuntimeError If the method is called while the ETracker is in simulation mode.
ValueError If use_gui is False and filename is not provided.

Examples

Load calibration from specific file

success = ET_controller.load_calibration('subject_01_calib.dat')
if success:
    ET_controller.start_recording('subject_01_data.h5')

Use GUI to select file

success = ET_controller.load_calibration(use_gui=True)

GUI on secondary monitor

success = ET_controller.load_calibration(
    use_gui=True, 
    screen=1, 
    alwaysOnTop=False
)

Multi-session workflow

# Session 1: Calibrate and save
ET_controller.calibrate(5)
ET_controller.save_calibration('participant_123.dat')
ET_controller.start_recording('session_1.h5')
# ... run experiment ...
ET_controller.stop_recording()

# Session 2: Load previous calibration
ET_controller.load_calibration('participant_123.dat')
ET_controller.start_recording('session_2.h5')
# ... run experiment ...
ET_controller.stop_recording()
Back to top