psychos.visual.units.DegUnit#
- class psychos.visual.units.DegUnit(window: Window)[source]#
Bases:
UnitDegrees of visual angle (deg) unit system.
This unit system converts degrees of visual angle into pixels based on the distance between the viewer and the screen.
It requires a known distance from the screen to accurately compute the size in pixels.
Methods
__init__(window)from_name(name, window)Instantiate a unit system class by name or return the instance if already provided.
inverse_transform(x, y)Convert coordinates from pixel values to units.
inverse_transform_size(width, height)Convert size from pixel values to units.
transform(x, y)Convert coordinates from units to pixel values.
transform_size(width, height)Convert size from units to pixel values.
Attributes
Get the distance from the viewer to the screen in centimeters.
Calculate pixels per centimeter based on the current screen DPI.
- inverse_transform(x: int, y: int) Tuple[float, float][source]#
Convert coordinates from pixel values to units.
- inverse_transform_size(width: int, height: int) Tuple[float, float][source]#
Convert size from pixel values to units.