ETracker.load_calibration

ETracker.load_calibration(filename=None, use_gui=False)

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

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

Name 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)

# 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