# psychopy.tools.monitorunittools¶

Functions and classes related to unit conversion respective to a particular monitor

 convertToPix(vertices, pos, units, win) Takes vertices and position, combines and converts to pixels from any unit cm2deg(cm, monitor[, correctFlat]) Convert size in cm to size in degrees for a given Monitor object cm2pix(cm, monitor) Convert size in cm to size in pixels for a given Monitor object. deg2cm(degrees, monitor[, correctFlat]) Convert size in degrees to size in pixels for a given Monitor object. deg2pix(degrees, monitor[, correctFlat]) Convert size in degrees to size in pixels for a given Monitor object pix2cm(pixels, monitor) Convert size in pixels to size in cm for a given Monitor object pix2deg(pixels, monitor[, correctFlat]) Convert size in pixels to size in degrees for a given Monitor object

## Function details¶

psychopy.tools.monitorunittools.convertToPix(vertices, pos, units, win)[source]

Takes vertices and position, combines and converts to pixels from any unit

The reason that pos and vertices are provided separately is that it allows the conversion from deg to apply flat-screen correction to each separately.

The reason that these use function args rather than relying on self.pos is that some stimuli use other terms (e.g. ElementArrayStim uses fieldPos).

psychopy.tools.monitorunittools.cm2deg(cm, monitor, correctFlat=False)[source]

Convert size in cm to size in degrees for a given Monitor object

psychopy.tools.monitorunittools.cm2pix(cm, monitor)[source]

Convert size in cm to size in pixels for a given Monitor object.

psychopy.tools.monitorunittools.deg2cm(degrees, monitor, correctFlat=False)[source]

Convert size in degrees to size in pixels for a given Monitor object.

If correctFlat == False then the screen will be treated as if all points are equal distance from the eye. This means that each “degree” will be the same size irrespective of its position.

If correctFlat == True then the degrees argument must be an Nx2 matrix for X and Y values (the two cannot be calculated separately in this case).

With correctFlat == True the positions may look strange because more eccentric vertices will be spaced further apart.

psychopy.tools.monitorunittools.deg2pix(degrees, monitor, correctFlat=False)[source]

Convert size in degrees to size in pixels for a given Monitor object

psychopy.tools.monitorunittools.pix2cm(pixels, monitor)[source]

Convert size in pixels to size in cm for a given Monitor object

psychopy.tools.monitorunittools.pix2deg(pixels, monitor, correctFlat=False)[source]

Convert size in pixels to size in degrees for a given Monitor object