Dot pattern of a matrix

Hi everybody

In my experiment, I wanna show subjects a 3*3 matrix with 4 dot it it, and later ask them to remember the dot pattern of the matrix. Is it possible to doing this without dealing with codes?


You really need to describe your task (both the stimuli and the expected response) in much more detail.

You know, it is originally a working memory task and my goal is to load the working memory capacity of participants. My experiment contains three parts. First, presenting dot pattern. Second, a reasoning task in which subjects have to answer some question while trying not to forger the dot pattern. finally, remembering task in which participants need to retrieval the dot pattern.

In other words, participants is presented a visuospatial storage task. Prior to the reasoning task, a pattern of dots is briefly presented (900ms) in a 3 x 3 grid for participants to memorize and keep in mind while reasoning. After the reasoning task, participants is subsequently presented a blank grid into which they should click with the mouse to reproduce the remembered pattern (an indicated dot could be removed by clicking again).

So, here is my problem. How could I present the response stimuli of 3*3 grid to participants? Is it possible to do this without writing codes?

Thank you in advance

Certainly. Let’s just cover the stimulus presentation, and worry about the response collection later. I’d suggest you create one image stimulus component that simply displays a white square that will cover the entire area of your 3 × 3 grid to provide a background for the dots. Then create 9 polygon stimuli for your dots (specify them to have, say 99 vertices so they look like a circle, and give them a black fill colour). Give each of them a location so that they are drawn with the proper spacing across the white background square. Add some line stimuli if you need to provide some grid lines.

Note that the background square needs to be at the top of the Builder window, as that gets drawn first. If it is lower down, it will be drawn later, and cover the other stimuli.

In your conditions file, you will need to specify the visibility of each dot (0 = invisible, 1 = visible). Create 9 columns, one for each dot, with names that make sense to you (e.g. a linear series dot_1 through dot_9, or the grid locations like dot_1_1 through dot_3_3). That is, you need nine values on each row to control the visibility of the dots on that particular trial.

Then go back to each of your dot stimulus components and enter the appropriate column name in the opacity field of each stimulus (i.e. dot_1, dot_2, etc).

Put a loop around the routine and see how the display of the dots changes from trial to trial, in accordance with what you specify in your conditions file.

1 Like

Sorry, due to me introductory knowledge of Psychopy, I am a little confused. I am afraid i couldn’t execute your instruction. I explain my experiment clearly again.

First, we want to show participant this 3*3 grid. They need to memorize the location of dots.

Then, they need to retrieve the pattern of previous grid by clicking on the blank grid which is presented to them as below.

According to your comment “Put a loop around the routine and see how the display of the dots changes from trial to trial, in accordance with what you specify in your conditions file”, I didn’t know how condition file and loop can help us here.

Thank you

Then I think you really need to learn the basics of how to use this software. Perhaps start with Jon Peirce’s excellent YouTube video showing how to implement the Stroop task. No, it is not similar to your task, but it will show you the basic structure of how you control stimuli on each trial using a list of variables.

1 Like

Dear Michael,

It worked great. I understand your points finally. Everything is great.

This is my experiment till now:

And this is my condition file:

So, this is stimulus presentation. Now, we need data collection. Participants should click on a blank grid to specify the location of dots. I would appreciate it if you could help me. Thank you

Dear Michael,

I would appreciate it if you could help me with the rest of the task. I have done your instructions so far and you can find them in the comment above. Thank you

I don’t obsessively check this forum on weekends :wink:

Well done. You would have learned a lot by working through that.

The next step will require adding a small amount of code to your experiment. i.e. this sort of specific response collection is not something that can be done just by using the graphical components you have used so far.

This is done by inserting a “code component” into the relevant routine, and typing code in one of its tabs so that it runs at the right time (e.g. at the beginning of the experiment, at the beginning or end of the routine, etc). In your case, you will mostly want code that runs on every screen refresh (e.g. typically 60 times a second for a standard LCD screen).

What you will do is, 60 times a second, check to see if the mouse has been clicked in one of your stimuli. If so, you store that response in the data. You’ll probably need to create a second routine that is similar to your current one, but instead of an array of 9 dot stimuli, you’ll need an array of nine squares that the person can click on to give a response. If you are using the latest version of PsychoPy, you should be able to copy your existing routine, give it a new name, and modify your existing nine stimuli as required.

Look here for a start re the code:

The code will need to be customised for your particular purposes. In particular, you’ll need to think about how to decide when the response trial is complete. But come back to us when you have got the basic click detection working.

Hi! I’m currently working on an experiment that contains a grid. Our experiment will have a stimulus disappear from the grid. A new stimulus will then appear, and we will ask if they overlap. Did you use the builder view to create the grid or the code view? I am struggling to just make the plain grid. Any help would be greatly appreciated!

Hi @Jill_Brennan

I honestly do not remember how I created the task and we did not finish it because the experiment was canceled. However, for your task, I think you can easily create it. As Michael suggested, first concentrate on the presentation of your stimuli, and then collecting data.

Regarding the presentation, you can create 9 squares on the screen and place them in a way to create a 3x3 grid. This is for your grid background. Now, let’s think about the stimuli.

I am not sure what kind of stimulus you want to present, but let’s consider it is two images. On your condition file, you can specify your image address and locations as below:

For the location, you can do some trials and errors to find 9 locations that show your images in each grid cell.

Now in your routine, suppose you want to present the first image for 3s and the second image with a keyboard component with two keys (to respond if the images overlap or not). For each image, give the locations to the image component (e.g., $image_one_loc). And this is how you present your stimuli.

For the data collection, your keyboard response record all the answers and you can find correct and incorrect answers in the data cleaning phase, after you collect your data (but do check the responses to make sure everything is recorded). An easier way is to add a column to your data to show the accuracy in each trial. All you need is to add the following code to the end routine tab. Suppose for overlaped responses, they should press A and for not overlapped ones, L. Change the my_keyboard variable name to the name of your actual keyboard.

## In the End Routine Tab:
trial_accuracy = 0

if my_keyboard.keys == A and overlap == 'yes':
    trial_accuracy= 1
if my_keyboard.keys == L or overlap == 'no':
    trial_accuracy= 1
    trial_accuracy= 0

#And save the data
thisExp.addData (“trial_accuracy”, trial_accuracy)

Hope that helps.