change detection task
Hey everyone,
I am trying to program my first experiment, which is a change detection task. The participants are presented with 2 or 4 face pictures and after a short break are again presented with 2 or 4 pictures, one of which could have changed (new face). The task is to indicate whether a change has occurred or not. Before the initial picture presentation arrows indicate on which side, left or right, a change could occur. I have an item pool of 24 pictures which should be paired or grouped randomly, without showing the exact same coupling twice. If a change occurs the new face should have the same sex as the face in the picture before, otherwise sex does't matter. I'd like to have a total of 768 trials, with 50% change trials, half of which with 2 and 4 pictures, equally distributed on the top and bottom half of the screen and on the left and right side (indicated by the arrow cue).
So the sequence would look like this:
arrow cue: left or right
memory array: 2 (both at the top or both at the bottom of the screen) or 4 pictures, randomly drawn from a set of 24
short break
testarray: 2 or 4 pictures, same as in the memory array except in change trials: one pictures changes (only in direction of arrow cue)
I'm having problems with selecting random pictures from the item pool and making sure that the change picture (in the testarray) has the same sex as the picture in the memory array, cause I'm also not sure on where to define this.
My second (big) problem is that I don't know how to vary between the presentation of two or four pictures; I tried to implement multiple sketchpads with two or four placeholders for the pictures and a variable show,,if comment but then I don't know how to insert the pictures into that. I guess I should use an inline_script, but as I am rather new to this, I really don't know on how to start. If anyone could make any sense out of any of this, I would be really happy and would appreciate the help.
Thanks!
Comments
I moved it to the OpenSesame section (assuming this is where it belongs).
Hi Sabine,
Could you maybe make a quick figure of your procedure? This will make it easier to understand what you want. Have you managed to get started with some bits of your paradigm? If so, please share, then it is easier for us to direct you to the solutions. Most of this design can be fixed with properly making use of the loop table, but some inline coding will be necessary as well. For example, you will probable have to lists of image filenames, one for male an one for females ones. On every trial you can use an if/else statement to decide whether you want to replace one of the stimuli, and if so whether is female or male (you also need a variable that codes for sex). In case of a switch, you then can decide which of the two lists to draw a replacement from.
(Btw. Try our advanced tutorial or check some example experiments to learn about inline_coding)
Eduard
Hey Eduard,
thank you very much for your reply!
I attached a figure of exemplary change and no change trials. I also attached the experiment I created so far (without the picture files).
I tried to start with the practice loop, in which the participants can familiarize themselves with the task and are also provided with perfomance feedback. To insert the pictures I just created four variables and mixed them randomly, I guess this could be done in a much more sophisticated way! As you can see, I am very much a beginner with Opensesame and programming, so I hope there is something to work with.
Thanks again for your help,
Sabine
okay, so I tried to work on and develop my paradigm. I did the VisualWorld tutorial and tried to orient my paradigm on that. I created the variables in the loop as you can see in the image file that I attached.
at the end I put this:
shuffle_horiz pos1 pos2 pos3 pos4
shuffle pic1
shuffle pic2
shuffle pic3
shuffle pic4
so that picture presentation and picture location is random and shuffled- so far so good. I then created two sketchpads which should be shown depending on the variable "num_pic", so either two or four pictures are shown. So for the four-picture sketchpad that is not a problem, I just set show-if to num_pic=4 in the test sequence. But for the two-picture sketchpad I only want to show those two pictures that are in accordance to the arrow_cue, so only the two left or right (bottom and top) pictures. I tried to come up with various code for that in the show-if command of the sketchpad (exemplary for pic1):
show_if="[arrow_cue] in [pos1]"
show_if="[pos1]==bottom[arrow_cue]or[pos1]==top[arrow_cue]"
but the result is that no pictures are shown at all. How can I get that right?
I now managed to set a fifth variable (pic5) which serves as the change picture for the second presentation and it seems to work (it also appears on the correct, arrow indicated side):
draw image center=1 file="[pic5]" scale=1 show_if="[change]==1" x="[=-480 if 'left' in var.arrow_cue else 480]" y="[=-288 if 'top' in var.pos5 else 288]" z_index=0
The only thing missing there is that it still picks random pictures, but it should show the same gender as the picture in the memory array. How could I implement that?
Thank you for your help!
Best, Sabine
Hey,
new approach: I tried to replace the variables in the loop with an inline script.
So I first set the picture list:
import random
picture_list = ['F1.jpg','F10.jpg','F12.jpg','F13.jpg','F14.jpg','F15.jpg','F16.jpg','F17.jpg','F18.jpg','F2.jpg','F19.jpg','F20.jpg','F21.jpg','F22.jpg','F23.jpg','F24.jpg','F3.jpg','F4.jpg','F5.jpg','F6.jpg','F7.jpg','F8.jpg', 'F9.jpg','F11.jpg','M1.jpg','M10.jpg','M11.jpg','M12.jpg','M13.jpg','M14.jpg','M15.jpg','M16.jpg','M17.jpg','M18.jpg','M19.jpg','M2.jpg','M20.jpg','M21.jpg','M22.jpg','M23.jpg','M24.jpg','M3.jpg','M4.jpg','M5.jpg','M6.jpg','M7.jpg','M8.jpg','M9.jpg']
random.shuffle(picture_list)
Then I define the variables arrow_cue (left/right) and change (one/two/three) in the loop.
Then I set the gender specific lists:
import random
picture_list_female = ['F1.jpg','F10.jpg','F12.jpg','F13.jpg','F14.jpg','F15.jpg','F16.jpg','F17.jpg','F18.jpg','F2.jpg','F19.jpg','F20.jpg','F21.jpg','F22.jpg','F23.jpg','F24.jpg','F3.jpg','F4.jpg','F5.jpg','F6.jpg','F7.jpg','F8.jpg', 'F9.jpg','F11.jpg']
picture_list_male = ['M1.jpg','M10.jpg','M11.jpg','M12.jpg','M13.jpg','M14.jpg','M15.jpg','M16.jpg','M17.jpg','M18.jpg','M19.jpg','M2.jpg','M20.jpg','M21.jpg','M22.jpg','M23.jpg','M24.jpg','M3.jpg','M4.jpg','M5.jpg','M6.jpg','M7.jpg','M8.jpg','M9.jpg']
and try to avoid the doubling of pictures:
list_target = random.sample(picture_list, 4)
print(list_target)
picture1 = list_target[0]
picture2 = list_target[1]
picture3 = list_target[2]
picture4 = list_target[3]
var.pic1 = picture1
var.pic2 = picture2
var.pic3 = picture3
var.pic4 = picture4
Then I put a sketchpad with the pictures (
draw image center=1 file="[pic1]" scale=1 show_if=always x=-512 y=-256 z_index=0
draw image center=1 file="[pic2]" scale=1 show_if=always x=480 y=-224 z_index=0
draw image center=1 file="[pic3]" scale=1 show_if=always x=-512 y=224 z_index=0
draw image center=1 file="[pic4]" scale=1 show_if=always x=480 y=256 z_index=0)
and then the inline script for the change:
if var.pic2 in picture_list_female:
picture_list_female.remove(var.pic2)
var.pic5 = random.sample(picture_list_female, 1)[0]
if var.pic2 in picture_list_male:
picture_list_male.remove(var.pic2)
var.pic5 = random.sample(picture_list_male, 1)[0]
if var.pic3 in picture_list_female:
picture_list_female.remove(var.pic3)
var.pic5 = random.sample(picture_list_female, 1)[0]
if var.pic3 in picture_list_male:
picture_list_male.remove(var.pic3)
var.pic5 = random.sample(picture_list_male, 1)[0]
if var.pic4 in picture_list_female:
picture_list_female.remove(var.pic4)
var.pic5 = random.sample(picture_list_female, 1)[0]
if var.pic4 in picture_list_male:
picture_list_male.remove(var.pic4)
var.pic5 = random.sample(picture_list_male, 1)[0]
if var.change == 'two' and var.arrow_cue=='left':
var.pic1 = var.pic5
if var.change == 'two' and var.arrow_cue=='right':
var.pic2 = var.pic5
if var.change == 'three' and var.arrow_cue=='left':
var.pic3 = var.pic5
if var.change == 'three' and var.arrow_cue=='right':
var.pic4 = var.pic5
And then again a sketchpad with pictures (with and without the change).
The replacement of the pictures seems to work. There seems to be no doubling of the pictures aswell.
What's not working is that the change picture (picture 5) has the same gender as the pic it should be replacing (but is not the same as the othe picture(s)). I tried to solve that with the male/female list, but I guess I did not do it right. And I am running out of ideas
I would really appreciate the help!
Thanks, Sabine
Hi,
This is because you pick again from the same list. For example:
You remove pic2, which is female, and replace with another female face. Shouldn't you select here from the other gender list?
Does that make sense?
Eduard
Hey,
No, because that is what I want it to do: remove pic2 (female) and replace it with change picture (pic5) which should have the same gender as pic2, therefore I want to select from the same gender list. I noticed my message was rather confusing, sorry!
I now came up with this:
It's not really elegant but at least it seems to work
Sabine