get_tobii_pos
get_tobii_pos(win, p, units=None)Convert PsychoPy coordinates to Tobii ADCS coordinates.
Transforms coordinates from PsychoPy’s coordinate system to Tobii’s Active Display Coordinate System (ADCS). Essential for sending calibration target positions to the Tobii eye tracker during calibration procedures.
ADCS uses normalized coordinates where (0,0) is top-left and (1,1) is bottom-right, providing a hardware-independent coordinate system.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| win | psychopy.visual.Window | The PsychoPy window providing unit and size information. | required |
| p | tuple | PsychoPy coordinates to convert as (x, y) in specified units. | required |
| units | str | Units of the input coordinates. If None, uses window’s default units. Supported: ‘norm’, ‘height’, ‘pix’, ‘cm’, ‘deg’, ‘degFlat’, ‘degFlatPos’. | None |
Returns
| Name | Type | Description |
|---|---|---|
| tuple | Tobii ADCS coordinates as (x, y) where both values are in range [0, 1]. (0, 0) is top-left, (1, 1) is bottom-right. |
Raises
| Type | Description |
|---|---|
| ValueError | If the provided units are not supported. |
Notes
This function is the inverse of get_psychopy_pos() and is primarily used during calibration to inform the eye tracker where targets are displayed.
Examples
from DeToX import Coords
# Convert calibration target position
target_psychopy = (0.2, -0.1) # Height units
target_tobii = Coords.get_tobii_pos(win, target_psychopy)
# Returns (x, y) in [0, 1] range for Tobii SDK
# Use during calibration
calibration.collect_data(target_tobii[0], target_tobii[1])
# Convert from different unit systems
target_norm = (-0.5, 0.5) # Normalized units
tobii_pos = Coords.get_tobii_pos(win, target_norm, units='norm')
# Works with pixel coordinates too
target_pix = (960, 540) # Center of 1920x1080 screen
tobii_pos = Coords.get_tobii_pos(win, target_pix, units='pix')
# Returns (0.5, 0.5) - center in ADCS