import math


def deg2pix(cmdist, angle, pixpercm):
    """Returns the value in pixels for given values (internal use)

	arguments
	cmdist	-- distance to display in centimeters
	angle		-- size of stimulus in visual angle
	pixpercm	-- amount of pixels per centimeter for display

	returns
	pixelsize	-- stimulus size in pixels (calculation based on size in
			   visual angle on display with given properties)
	"""

    cmsize = math.tan(math.radians(angle)) * float(cmdist)
    return cmsize * pixpercm