psychopy.org | Reference | Downloads | Github

Polygon component randomization across trials

Hello,

Psychopy Version 1.84.2 on mac. We are trying to program a local-global task. In total we will use 6 different displays that differ in local-global features. Using the polygon component we managed to create all displays and currently we can present each display block-wise but we want to present the different displays randomly across trials. Since each display type requires different number of polygon component in a given trial, it is not possible to create a variable in the condition file. Is there a way to present different displays in trial-wise order?

Many thanks,

Elif Memis

Hi @elifmemis. You can create trial-wise randomization with the Builder and conditions file. In the attached example, we have a simple hierarchical perception display using 6 polygon components and a code component. The six polygons are used to display either a global square or triangle, and locally one of the shapes changes from a square to a triangle. If you want to display varying numbers of polygons to determine your global shape, you need to change the opacity of polygons to determine whether or not you want to show them. The opacity and position of shapes is set in the conditions file, such that when a global triangle is shown, the opacity of the square corners is set to zero i.e., invisible. Also, we can determine the local shape of polygons in the excel file by setting a number of sides for each polygon and passing that to the polygon component at the beginning of every trial/routine using a code component. Randomization of trials is set in the loop properties.

globLoc_example.psyexp (14.0 KB)
globLoc.xlsx (8.9 KB)

Hello David,

Many thanks for your help. It worked well when we applied your recommendation. If we need further information, we will contact with you.

Thank you

Hi David,

Our current problem is to differentiate square from rhombus. You used rhombus form, but we want to show square too. However, it automatically gives us rhombus when we write vertices number as 4. @dvbridges

Thank you.

HI @elifmemis. The square is a rhombus because I think your units are set to “norm” and

In normalised (‘norm’) units the window ranges in both x and y from -1 to +1. That is, the top right of the window has coordinates (1,1), the bottom left is (-1,-1). Note that, in this scheme, setting the height of the stimulus to be 1.0, will make it half the height of the window, not the full height (because the window has a total height of 1:-1 = 2!). Also note that specifying the width and height to be equal will not result in a square stimulus if your window is not square - the image will have the same aspect ratio as your window. e.g. on a 1024x768 window the size=(0.75,1) will be square."

See here for docs. To fix, first change the orientation of the rhombus by 45 degrees then use another unit for the shapes, rather than the “norm” values set in the preferences e.g., use cm instead. Remember to change the sizes of the stimuli else they may not appear if they are smaller than 1 pixel.

1 Like