Polygon Component¶
- The Polygon stimulus allows you to present a wide range of regular geometric shapes. The basic control comes from setting the number of vertices:
2 vertices give a line
3 give a triangle
4 give a rectangle etc.
a large number will approximate a circle/ellipse
The size parameter takes two values. For a line only the first is used (then use ori to specify the orientation). For triangles and rectangles the size specifies the height and width as expected. Note that for pentagons upwards, however, the size determines the width/height of the ellipse on which the vertices will fall, rather than the width/height of the vertices themselves (slightly smaller typically).
- Categories:
Stimuli
- Works in:
PsychoPy, PsychoJS
Parameters¶
Basic¶
The required attributes of the stimulus, controlling its basic function and behaviour
- Name
Everything in a PsychoPy® experiment needs a unique name. The name should contain only letters, numbers and underscores (no punctuation marks or spaces).
- Start
When the Polygon Component should start, see Defining the onset/duration of components.
- Expected start (s)
If you are using frames to control timing of your stimuli, you can add an expected start time to display the component timeline in the routine.
- Start type
How do you want to define your start point?
Options:
time (s)
frame N
condition
- Stop
When the Polygon Component should stop, see Defining the onset/duration of components.
- Expected duration (s)
If you are using frames to control timing of your stimuli, you can add an expected duration to display the component timeline in the routine.
- Stop type
How do you want to define your end point?
Options:
duration (s)
duration (frames)
time (s)
frame N
condition
- Shape
What shape is this?
Options:
Line
Triangle
Rectangle
Circle
Cross
Star
Arrow
Regular polygon…
Custom polygon…
- Num. vertices (if :ref:`polygoncomponent-shape` is “Regular polygon…”)
How many vertices in your regular polygon?
- Vertices (if :ref:`polygoncomponent-shape` is “custom polygon…”)
What are the vertices of your polygon? Should be an nx2 array or a list of [x, y] lists
Layout¶
How should the stimulus be laid out on screen? Padding, margins, size, position, etc.
- Size [w,h]
Size of this stimulus [w,h]. Note that for a line only the first value is used, for triangle and rect the [w,h] is as expected, but for higher-order polygons it represents the [w,h] of the ellipse that the polygon sits on!!
- Position [x,y]
Position of this stimulus (e.g. [1,2] )
- Spatial units
Spatial units for this stimulus (e.g. for its position and size), see Units for the window and stimuli for more info.
Options:
from exp settings
deg
cm
pix
norm
height
degFlatPos
degFlat
- Anchor (if :ref:`polygoncomponent-shape` isn’t ==’line’)
Which point in this stimulus should be anchored to the point specified by Position [x,y]?
Options:
center
top-center
bottom-center
center-left
center-right
top-left
top-right
bottom-left
bottom-right
- Orientation
Orientation of this stimulus (in deg)
Options:
-360
360
- Draggable?
Should this stimulus be moveble by clicking and dragging?
Appearance¶
How should the stimulus look? Colors, borders, styles, etc.
- Fill color
Fill color of this stimulus (e.g. $[1,1,0], red )
- Border color
Border color of this stimulus (e.g. $[1,1,0], red )
- Color space
In what format (color space) have you specified the colors? See Color spaces for more info.
Options:
rgb
dkl
lms
hsv
- Opacity
Vary the transparency, from 0.0 (invisible) to 1.0 (opaque)
- Contrast
Contrast of the stimulus (1.0=unchanged contrast, 0.5=decrease contrast, 0.0=uniform/no contrast, -0.5=slightly inverted, -1.0=totally inverted)
- Line width
Width of the shape’s line (always in pixels - this does NOT use ‘units’)
Texture¶
Control how the stimulus handles textures.
- Interpolate
How should the image be interpolated if/when rescaled
Options:
linear
nearest
Data¶
What information about this Component should be saved?
- Save onset/offset times
Store the onset/offset times in the data file (as well as in the log file).
- Sync timing with screen refresh
Synchronize times with screen refresh (good for visual stimuli and responses based on them)
Testing¶
Tools for testing, debugging and checking the performance of this Component.
- Disable Component
Disable this Component
- Validate with…
Name of the Validator Routine to use to check the timing of this stimulus. Options are generated live, so will vary according to your setup.
See also
API reference for Polygon
API reference for Rect
API reference for ShapeStim