Screen#
- class pymovements.Screen(width_px: int | None = None, height_px: int | None = None, width_cm: float | None = None, height_cm: float | None = None, distance_cm: float | None = None, origin: str | None = None, *, resolution: tuple[int | None, int | None] | None = None, size: tuple[float | None, float | None] | None = None)[source]#
Screen class for holding screen properties.
- distance_cm#
Eye-to-screen distance in centimeters. If None, a distance_column must be provided in the DatasetDefinition or Gaze, which contains the eye-to-screen distance for each sample in millimeters. (default: None)
- Type:
float | None
- origin#
Specifies the screen location of the origin of the pixel coordinate system. (default: None)
- Type:
str | None
- Parameters:
width_px (int | None) – Screen width in pixels. (default: None)
height_px (int | None) – Screen height in pixels. (default: None)
width_cm (float | None) – Screen width in centimeters. (default: None)
height_cm (float | None) – Screen height in centimeters. (default: None)
distance_cm (float | None) – Eye-to-screen distance in centimeters. If None, a distance_column must be provided in the DatasetDefinition or Gaze, which contains the eye-to-screen distance for each sample in millimeters. (default: None)
origin (str | None) – Specifies the screen location of the origin of the pixel coordinate system. (default: None)
resolution (tuple[int | None, int | None] | None) – Screen resolution in pixels as tuple of width and height. (default: None)
size (tuple[float | None, float | None] | None) – Screen size in centimeters as tuple of width and height. (default: None)
Examples
>>> screen = Screen( ... width_px=1280, ... height_px=1024, ... width_cm=38.0, ... height_cm=30.0, ... distance_cm=68.0, ... origin='upper left', ... ) >>> print(screen) Screen(resolution=(1280, 1024), size=(38.0, 30.0), distance_cm=68.0, origin='upper left')
We can also access the screen boundaries in degrees of visual angle. This only works if the distance_cm attribute is specified.
>>> screen.x_min_dva -15.59... >>> screen.x_max_dva 15.59... >>> screen.y_min_dva -12.42... >>> screen.y_max_dva 12.42...
Methods
__init__([width_px, height_px, width_cm, ...])pix2deg(arr)Convert pixel screen coordinates to degrees of visual angle.
to_dict(*[, exclude_none, ...])Convert the Screen instance into a dictionary.
Attributes
height_cmHeight of screen in cm.
height_pxHeight of screen in pixels.
resolutionResolution of screen in pixels (width, height).
sizeSize of screen in centimeters (width, height).
width_cmWidth of screen in cm.
width_pxWidth of screen in pixels.
x_max_dvaMaximum screen x-coordinate in degrees of visual angle.
x_min_dvaMinimum screen x-coordinate in degrees of visual angle.
y_max_dvaMaximum screen y-coordinate in degrees of visual angle.
y_min_dvaMinimum screen y-coordinate in degrees of visual angle.