pix2tobii

pix2tobii(win, p)

Convert PsychoPy pixel coordinates to Tobii ADCS coordinates.

Low-level conversion function transforming pixel coordinates with centered origin (PsychoPy convention) to Tobii’s normalized ADCS coordinates with top-left origin. Used internally by get_tobii_pos().

Parameters

Name Type Description Default
win psychopy.visual.Window The PsychoPy window providing screen dimensions for normalization. required
p tuple PsychoPy pixel coordinates as (x, y). Origin at screen center, x increases rightward, y increases upward. required

Returns

Name Type Description
tuple Tobii ADCS coordinates as (x, y) in range [0, 1]. Origin is top-left, x increases rightward, y increases downward.

Notes

The conversion process: 1. Normalize by screen dimensions to get [0, 1] range 2. Translate origin from center to top-left (+0.5 offset) 3. Invert Y-axis to match Tobii’s top-down convention

Examples

from DeToX import Coords

# Center of 1920x1080 screen
pixel_center = (0, 0)  # PsychoPy pixel center
tobii_center = Coords.pix2tobii(win, pixel_center)
# Returns (0.5, 0.5) - center in ADCS

# Top-left corner
pixel_tl = (-960, 540)
tobii_tl = Coords.pix2tobii(win, pixel_tl)
# Returns (0.0, 0.0) - top-left in ADCS
Back to top