Differentiating when a distractor image is presented relative to a target

Hi there,
I’m really new at coding and am trying to complete an experiment that goes like this:

Neutral image is presented,
Another neutral image is presented with an arrow superimposed on top of it
A threatening image is presented
Another neutral image
Another neutral image
Question: which direction was the arrow facing?
Keyboard responses allowed: up, down, left and right arrow keys

What I’m struggling with is that I want the threatening image to appear at different points in the stream (e.g. vary between being the second image, third image and so on) on each trial.

So far I’ve only managed to set it up so that the threatening image is displayed third in the stream of images only.

Any help would be appreciated! My builder view is below:

Hello,

I attached a toy-experiment in which the target appears as the second or third stimulus in a row of three stimuli. I hope that this is explicit enough.

Position.psyexp (14.4 KB)
loopPosition.xlsx (8.7 KB)

Best wishes Jens

Thank you for your reply! Here’s how I have adjusted the code to my experiment. However, it doesn’t seem to have changed anything and the images are still presented the same. Any suggestions?





Hello,

Well, the if-branch and the elif-branch are identical. You must assign a different stimulus to Neutral3 and distractor in the elif-branch.

Neutral3 = distractorlist
distractor = Neutralimagelist3

Best wishes Jens

I’ve made that edit and adjusted it so that it fits my experiment and where I would need the images to present although it is still displaying only in the 4th slot (where it is on builder view) each time. Any suggestions?
Thanks again


Hello,

your code can‘t work because you stimuli are called N1, N2, aso., Dis, b1. The variable-names in the if-construction must match your stimulus names.

Best wishes Jens

Hi Jens,
I’ve made that adjustment! It’s just presenting nothing at all where the fourth image of the stream should be and isn’t shuffling. Code below.
Thanks again for all your help with this I’ve gone back to my spreadsheet and seen if there is an error with that as the fourth one is where my distractor should be according to builder view but surely if it were shuffling the blank screen would present at the intervals coded for?
Thanks again,
Caitlin


Hello Caitlin

well, your if-elif construction still assigns the same stimuli to the same position. It is in both branches
ˋˋˋ
N3 = Dist
Dist = N3
ˋˋˋ

In addition, you seem to using the same variable and column-names. That should be avoided.

Another option that came to my mind instead of shuffling positions would be to set new start-times. But I won‘t be able to do that before next week.

Best wishes Jens

If you could let me know how to try the other option when you’re available that would be great. I’ve put my code below one last time. My column names are distracted and Neutralimagelist3. My variable names are N3 and Dist.
This error message is now appearing:
Dist.setImage(‘distracted’)
AttributeError: ‘str’ object has no attribute ‘setImage’

I’m unsure really how to proceed.
Thanks again


In your screenshot I can see that you have an image component called Dist.

However, in your code you also have Dist = " "

This code will destroy your image component, which is why you can’t set it’s image.

Hi there,
I have removed that section of the code and the same error message presents.
Should I have altered it to another name?
Thanks

Are you running the latest version of your code. Use Ctrl-Shift-R to refresh or an incognito tab.

Hello caitlin

please find a attached a toy-experiment in which target and distractor alter between 3rd and 6th position in the stimulus flow . Again, I am using text-stimuli for reasons of simplicity. I tried to streamline my variable names for ease of understanding.

It might a a good exercise to use this toy-experiment and adopt it to use your image stimuli.

Best wishes Jens
loopPosition.xlsx (9.0 KB)
Position.psyexp (14.4 KB)