Aperture

Stimulus class to restrict a stimulus visibility area to a basic shape or list of vertices. This is a lazy-imported class, therefore import using full path from psychopy.visual.aperture import Aperture when inheriting from it.

Attributes

Details

class psychopy.visual.Aperture(*args, **kwargs)[source]

Restrict a stimulus visibility area to a basic shape or list of vertices.

When enabled, any drawing commands will only operate on pixels within the Aperture. Once disabled, subsequent draw operations affect the whole screen as usual.

Supported shapes:

  • ‘square’, ‘triangle’, ‘circle’ or None: a polygon with appropriate nVerts will be used (120 for ‘circle’)

  • integer: a polygon with that many vertices will be used

  • list or numpy array (Nx2): it will be used directly as the vertices to a ShapeStim

  • a filename then it will be used to load and image as a ImageStim. Note that transparent parts in the image (e.g. in a PNG file) will not be included in the mask shape. The color of the image will be ignored.

See demos/stimuli/aperture.py for example usage

Author:

2011, Yuri Spitsyn 2011, Jon Peirce added units options, Jeremy Gray added shape & orientation 2014, Jeremy Gray added .contains() option 2015, Thomas Emmerling added ImageStim option


Back to top