I am trying to buil a memory test. It is a 4x4 Grid (16 positions) and show between 3 and 8 squares randomly on the screen at random positions. The number of stimuli should change randomly on each trial. Right now i can only produce a Grid with all the possitions filled or blank (opacity 1/0). I want the stimulus to be shown in a random sequence. I saw other posts about this topic but i still could not achieve the desired results.
In my builder, i have a image of a grid, and 16 polygons.
This is my conditions file.
this is how my first polygon is setted. the others have small changes regarding the position, to match the grid.
I am new with psychopy. I was able to do a digit and word recall before, but that is my whole knowledge so far.
Thank you in advance for your help
You either need to have all the possible rows of 3-8 squares in your Excel file (which will be a lot of rows) or use a code component.
Your opacity should be set every repeat not every frame.
You could have
for Idx in range(nDots):
for Idx in range(nDots,16):
and then use dotOpacity through dotOpacity for your opacities.
Thank you for your reply!
I added a code component to the routine and pasted the code you sent me (thank you).
then i changed the opacity to every repeat.
I dont understant what you mean by “and then use dotOpacity through dotOpacity for your opacities”.
Could you explain?
Thank you very much!!
Set the opacity for dot1 to dotOpacity
Set the opacity for dot2 to dotOpacity
Set the opacity for dot3 to dotOpacity
and so on
My code should have assigned some of the opacity values as 1 and the others as 0
It´s not working. every place in the grid its blank.
Please could you show a screenshot of the code component and an example dot?
Thank you for your help.
That looks correct. Maybe try print(‘nDots’,nDots,‘Opacity’,dotOpacity) after the Begin Routine code. If you can’t get that to give you any output please send me your psyexp file and I’ll take a quick look.
I tried to do what you asked but it gave me some type of error.
dotmatrix.psyexp (37.3 KB) excelldot.xlsx (8.7 KB) .
I attached the psyexp file and the Excell file as well.
Thank you so much for your quick replies and help
It works for me if I move your code component to the top of the routine (so it executes before the dots are drawn). You don’t need the Excel file.
It is almost perfect. thank you.
But i need the dots to appear as a sequence. they are appearing all at the same time. Is there something that i could change in the code?
How were you previously planning to create the sequence?
Personally I’d probably move the opacity code into Each Frame but I’d need to set up a flag to know which stage I was on.
for Idx in range(16):
if t > dotGap*dotNum and dotNum < nDots:
Opacity would now need to be set to each frame