How to set up an old-new recognition task with pictorial stimuli?

150 views
Skip to first unread message

Laura P

unread,
Nov 19, 2015, 6:16:25 PM11/19/15
to psychopy-users
Hello, 

For two days now, I have been trying to find an answer from the PsychoPy webpage, Google and YouTube, but I keep failing. As I do not possess Python skills, I am mainly using the Builder. I set up the basic Stroop task based on a YouTube video and it worked, but with pictorial stimuli it does not (even though I followed the few guidelines which I did manage to find, and even tried out some seemingly relevant codes). The closest I got was one picture out of many showing until I respond and that was it. I am becoming anxious since a major issue appeared with another program, but I have to start testing for my dissertation project on Monday. 

Anyway, what I am trying to do is to set up a old-new recognition task with pictorial stimuli (more than 100 images, hope that's not a problem) to get reaction times and answers to the question whether a person has seen a given image before or not. 

Could someone point me to the direction where I should look for answers, or even could help me to set it up somehow? I would not mind doing it in the Coder as I would like to learn Python at some point, but I figure it's a bit late to start now for this project. 

Any help would be appreciated! Thank you in advance.

Laura

Michael MacAskill

unread,
Nov 19, 2015, 6:27:15 PM11/19/15
to psychop...@googlegroups.com
Hi Laura,

> I set up the basic Stroop task based on a YouTube video and it worked, but with pictorial stimuli it does not
How exactly doesn't it work? A precise description is needed in order to get any sort of useful answer.

> Anyway, what I am trying to do is to set up a old-new recognition task with pictorial stimuli (more than 100 images, hope that's not a problem) to get reaction times and answers to the question whether a person has seen a given image before or not.
This sounds eminently feasible.

> Could someone point me to the direction where I should look for answers, or even could help me to set it up somehow?
We would love to help, but need to know some things first.

— What *exactly* you want to achieve (i.e. how stimuli are presented, what responses are sought, how stimuli depend on previous responses, how the experiment is structured in terms of loops and routines, etc).

— What have you implemented currently.

— How it is currently failing to achieve what you intend.

Regards,

Michael

Message has been deleted

Laura P

unread,
Nov 19, 2015, 9:10:27 PM11/19/15
to psychopy-users
Thank you! 

What do I want to achieve?
I would like all the stimuli (183 images) to be presented one at a time until a response is given, e.g. Image1, response, Image2, response etc. Each participant should be presented with all images in a random order (ideally a fixation cross would be shown before each image, but that's a secondary line of enquiry). I am looking for ''yes'' or ''no'' responses, so I would use two keyboard keys which the participants will be asked to press accordingly. Also, I would like to get the reaction times of participants for each stimulus. The overall set-up sounds quite simple: introduction & instructions --> image recognition task with RTs and yes/no responses recorded (maybe with a break or two) --> ''Thank you'', but I am struggling with the main part of it. 

What have I done so far?
I have uploaded 3 images (just trying it out with a couple of pictures for now, especially as adding them manually would likely drive me nuts) to the Builder view and applied them to the ''trial'' with responses after each image. Also, I added 3 loops (one for each picture) to the 'trial', but perhaps this would need a different set-up of routines and loops. After that I kind of followed the steps from the Stroop task video. I set up a .xlsx file with the all the file names of the stimuli and correct answer keys, but I wasn't sure if it's enough to write the names of the image files, or should I add .jpg to the end there. And apart from that I've spent hours to wrap my head around it.  

What is it doing now?
First of all, all the pictures I have added are presented at the same time. Secondly, the response keys I identified do not work - I just see all the stimuli on top of each other and can exit the screen by pressing the Esc key. At some points location detection errors show up. That's all I've got. 

I guess it would be the best to get to know the steps from the beginning as it seems to me that I have got it all wrong. 


Laura

Michael MacAskill

unread,
Nov 19, 2015, 9:19:14 PM11/19/15
to <psychopy-users@googlegroups.com>
Hi Laura,

Thanks, that detail helps a lot.

> I am looking for ''yes'' or ''no'' responses
What is the question?

If it is "have you seen this image before?", how do you want to handle the response to the first image (which by definition will be novel), or should that be presented separately?

Regards,

Michael


--
Michael R. MacAskill, PhD 66 Stewart St
Research Director, Christchurch 8011
New Zealand Brain Research Institute NEW ZEALAND

Senior Research Fellow, michael....@nzbri.org
Te Whare Wānanga o Otāgo, Otautahi Ph: +64 3 3786 072
University of Otago, Christchurch http://www.nzbri.org/macaskill

Michael MacAskill

unread,
Nov 19, 2015, 9:40:36 PM11/19/15
to <psychopy-users@googlegroups.com>
Dear Laura,

> I set up a .xlsx file with the all the file names of the stimuli and correct answer keys, but I wasn't sure if it's enough to write the names of the image files, or should I add .jpg to the end there.
Most definitely. Your file should look something like this, containing your 183 image names, and a variable name to refer to them with (I'll use "imageName"):

imageName
pic01.jpg
pic02.jpg
etc
etc

> What do I want to achieve?
> I would like all the stimuli (183 images) to be presented one at a time until a response is given, e.g. Image1, response, Image2, response etc. Each participant should be presented with all images in a random order
This is perfectly standard. Place a loop around your main trial routine, connect it to your .xlsx conditions file, and specify the loopType to be "random". This will give you 183 trials, in a different random order for each subject.

> (ideally a fixation cross would be shown before each image, but that's a secondary line of enquiry).
In your main trial routine, simply place an image component (or even just a text component set to display a '+' for example, specified for a certain period (say, lasting from 0 to 1.0 seconds).

Then insert the image component which will show the face, and have it start at the offset time of the fixation (1.0 seconds), but not have a specified duration (as it will be displayed indefinitely until a keypress occurs).

Similarly for your keyboard component: start at 1.0, last forever.


> I am looking for ''yes'' or ''no'' responses, so I would use two keyboard keys which the participants will be asked to press accordingly. Also, I would like to get the reaction times of participants for each stimulus. The overall set-up sounds quite simple: introduction & instructions
Put these on a separate initial routine, prior to the loop described above.

> --> image recognition task with RTs and yes/no responses recorded (maybe with a break or two)
We'll discuss the break bit later, once you have the main part running.

> --> ''Thank you'', but I am struggling with the main part of it.
Again, this goes in its own routine, after the loop running the trials.

i.e. at this stage, your experiment should look very simple: an intro routine, a trial routine, and a thank you routine, with the trial routine surrounded by a loop.

> What have I done so far?
> I have uploaded 3 images (just trying it out with a couple of pictures for now, especially as adding them manually would likely drive me nuts) to the Builder view and applied them to the ''trial'' with responses after each image. Also, I added 3 loops (one for each picture) to the 'trial', but perhaps this would need a different set-up of routines and loops.
No, you just want a single routine, single loop, and single image component. That routine will run 183 times, updating the face image as required.

In the image component image field, simply type:

imageName

and select "set every repeat" so that you get a new face image on every trial.

To keep things tidy, you will probably want to keep all of your 183 images in a subfolder, called, say, "images", in the same folder as your Builder .psyexp file. So in that case, use something like this:

'images/' + imageName


> What is it doing now?
> First of all, all the pictures I have added are presented at the same time.
This won't happen if you just have one image component to show your face stimulus.

> Secondly, the response keys I identified do not work
This is the only bit where things get slightly tricky. To get a "correct" or "incorrect" response, PsychoPy needs to know if the image has been shown before, but the order changes for each subject, so we can't extract the correct answer from the .xlsx file. So we will need to keep track of which images have been shown already.

This is easily do-able, but before giving a suggestion, I need some clarification. Do you have 183 different image files? Or is there some smaller number of images, which will be cycled through for 183 trials, so that some are repeated?

i.e. I need to know if we can figure out if an image has been shown before, on the basis of its name alone.

Laura P

unread,
Nov 20, 2015, 7:51:35 AM11/20/15
to psychopy-users
Thank you so, so much! I will have a go at this shortly, but will answer your questions before that. 

- Yes, the question will be whether the participant has seen the image before. However, I don't quite get what you mean by ''how do you want to handle the response to the first image'' as for all the stimuli I would want to see which key they pressed (e.g. 'z' for those they have not seen, 'm' for those they have). 

- Half of the pictures will be which the participant has seen before and the other half will be novel images (also, I did a mistake with the number, it'll be 192 images altogether)

- All the images would be shown once, i.e. none of the pictures should be repeated. 


Best,
Laura

Michael MacAskill

unread,
Nov 21, 2015, 3:10:14 AM11/21/15
to <psychopy-users@googlegroups.com>

> - Half of the pictures will be which the participant has seen before and the other half will be novel images (also, I did a mistake with the number, it'll be 192 images altogether)
>
> - All the images would be shown once, i.e. none of the pictures should be repeated.

Hi Laura,

This is where I get confused: images are never repeated, and yet half have been seen before??

Could you clarify that a bit more?

Cheers,

Michael



Laura P

unread,
Nov 21, 2015, 12:46:40 PM11/21/15
to psychopy-users
Oh! My apologies, I have been working on it for a while now so I forgot the most basic thing:

The recognition task is a part of a bigger experiment. The pictures have been presented to the participants for a free recall task and they will be tested for recognition later on. And half of the recognition task pictures will have been presented for the recall task (taking place before the recognition task which I am trying to set up).

Sorry about that!

Laura

Michael MacAskill

unread,
Nov 22, 2015, 3:57:22 PM11/22/15
to <psychopy-users@googlegroups.com>

> On 22/11/2015, at 06:46, Laura P <laurap...@gmail.com> wrote:
>
> Oh! My apologies, I have been working on it for a while now so I forgot the most basic thing:
>
> The recognition task is a part of a bigger experiment. The pictures have been presented to the participants for a free recall task and they will be tested for recognition later on. And half of the recognition task pictures will have been presented for the recall task (taking place before the recognition task which I am trying to set up).

Ahh, OK that makes it all very simple then. Set up your Excel file to have two columns, like this:

imageName correctResponse
pic01.jpg z
pic02.jpg m
pic03.jpg z
etc

with the second column depending on whether the images have been shown before.

In the keyboard component, select "Store correct" and type $correctResponse in the field that appears.

i.e. the keyboard component now knows what the correct response should be on each trial, by extracting it from the 'correctResponse' column in your .xlsx file.

Make sense?

Once you have this working, come back to discuss your query as to how to implement a break every so often.

Laura P

unread,
Nov 23, 2015, 7:23:05 PM11/23/15
to psychopy-users
It's all set up and working now. Thank you very much, again!

Is it difficult to make the breaks happen? I mean, I went through the trial myself and it didn't take too long, but just in case the participants would want a break, there perhaps should be a break after every 64 images (thus 2 breaks overall), or perhaps 1 half-way through, i.e. after 96 images, would do. 


Best,
Laura

Michael MacAskill

unread,
Nov 23, 2015, 8:10:53 PM11/23/15
to <psychopy-users@googlegroups.com>
Hi Laura,

> Is it difficult to make the breaks happen?
No. It is two lines of code in the "begin routine" tab of an optional break routine.

> I mean, I went through the trial myself and it didn't take too long, but just in case the participants would want a break, there perhaps should be a break after every 64 images (thus 2 breaks overall), or perhaps 1 half-way through, i.e. after 96 images, would do.
Please check the message archive from earlier today for a message from me about implementing exactly this.
Reply all
Reply to author
Forward
0 new messages