pymovements.gaze.Screen.pix2deg#

Screen.pix2deg(arr: float | list[float] | list[list[float]] | np.ndarray) np.ndarray#

Convert pixel screen coordinates to degrees of visual angle.

Parameters:

arr (float | list[float] | list[list[float]] | np.ndarray) – Pixel coordinates to transform into degrees of visual angle

Returns:

Coordinates in degrees of visual angle

Return type:

np.ndarray

Raises:

ValueError – If positions aren’t two-dimensional.

Examples

>>> arr = [(123.0, 865.0)]
>>> screen = Screen(
...     width_px=1280,
...     height_px=1024,
...     width_cm=38.0,
...     height_cm=30.0,
...     distance_cm=68.0,
...     origin='upper left',
... )
>>> screen.pix2deg(arr=arr)
array([[-12.70732231, 8.65963972]])
>>> screen = Screen(
...     width_px=1280,
...     height_px=1024,
...     width_cm=38.0,
...     height_cm=30.0,
...     distance_cm=68.0,
...     origin='center',
... )
>>> screen.pix2deg(arr=arr)
array([[ 3.07379946, 20.43909054]])