pymovements.transforms.pix2deg

pymovements.transforms.pix2deg(arr: float | list[float] | list[list[float]] | np.ndarray, screen_px: float | list[float] | tuple[float, float] | np.ndarray, screen_cm: float | list[float] | tuple[float, float] | np.ndarray, distance_cm: float, origin: str) np.ndarray[source]

Converts pixel screen coordinates to degrees of visual angle.

Parameters:
  • arr (float, array_like) – Pixel coordinates to transform into degrees of visual angle

  • screen_px (int, int) – Screen dimension in pixels

  • screen_cm (float, float) – Screen dimension in centimeters

  • distance_cm (float) – Eye-to-screen distance in centimeters

  • origin (str) – Specifies the screen location of the origin of the pixel coordinate system. Valid values are: center, lower left.

Returns:

Coordinates in degrees of visual angle

Return type:

np.ndarray

Raises:
  • TypeError – If arr is None.

  • ValueError – If dimension screen_px or screen_cm don’t match dimension of arr. If screen_px or screen_cm or one of its elements is zero. If distance_cm is zero. If origin value is not supported.