Blocks of Paired Images


Author
Message
lir1995
lir1995
Partner Member (701 reputation)Partner Member (701 reputation)Partner Member (701 reputation)Partner Member (701 reputation)Partner Member (701 reputation)Partner Member (701 reputation)Partner Member (701 reputation)Partner Member (701 reputation)Partner Member (701 reputation)
Group: Forum Members
Posts: 40, Visits: 190
Hello, 

I am trying to show participants images, where within a single block, two of the images are pairs of highly similar images (e.g., two different pictures of airports). Each block contains 8 trials, where one unique image is presented 4 times with trial unique words before switching to a pairmate. I was able to generate code to show the images together in a block. In order to show the images in pairs, I was pulling them from a list sequentially.

However, this posed a couple of problems:
1) This experiment will have 8 blocks. As it stands images 1 and 2 will always be in block 1. I'd really love to be able to randomize the blocks so it is random which pair comes first
2) If possible, I'd also like to be able to randomize whether picture 1 or 2 comes first in the pair. But this is less of an issue, and okay if not resolved.

Do you have any ideas on how to help with this randomization issue? I assume I am missing some knowledge of lists, perhaps there is a way to group pairs of items while randomly selecting these pairs, or somehow do this using multiple lists. I included code below I have been working on. Thank you in advance for any guidance!!

I apologize I was not able to upload the actual scenes for space issues

Code:
<item scenes>
/1 = "Scenes/Airport 1.jpg"
/2 = "Scenes/Airport 2.jpg"
/3 = "Scenes/Train 1.jpg"
/4 = "Scenes/Train 2.jpg"
/5 = "Scenes/Soccer Field 1.jpg"
/6 = "Scenes/Soccer Field 2.jpg"
/7 = "Scenes/Street 1.jpg"
/8 = "Scenes/Street 2.jpg"
/9 = "Scenes/Pool 1.jpg"
/10 = "Scenes/Pool 2.jpg"
/11 = "Scenes/Museum 1.jpg"
/12 = "Scenes/Museum 2.jpeg"
/13 = "Scenes/Salon 1.jpg"
/14 = "Scenes/Salon 2.jpeg"
/15 = "Scenes/Dentist 1.jpg"
/16 = "Scenes/Dentist 2.jpeg"
</item>

<text noun>
/ items = noun
/ select = values.noun_itemnumber
/ position = (50,50)
/ fontstyle = ("Arial", 30pt)
/ erase = false
</text>

<list noun_items>
/ poolsize = 50
</list>

<item noun>
/1 = "ACORN"
/2 = "ANCHOR"
/3 = "APPLE"
/4 = "APRON"
/5 = "ARROW"
/6 = "BACON"
/7= "TOWER"
/8 = "TUBA"
/9 = "BANDAGE"
/10 = "BANJO"
/11 = "BARLEY"
/12 = "BARREL"
/13 = "BASEBALL"
/14 = "BEAKER"
/15 = "BEAVER"
/16 = "BEETLE"
/17 = "BERRY"
/18 = "BINDER"
/19 = "BISCUIT"
/20 = "BISON"
/21 = "BLACKBOARD"
/22 = "BLENDER"
/23 = "BOTTLE"
/24 = "BRACELET"
/25 = "BRIEFCASE"
/26 = "BUILDING"
/27 = "COOKBOOK"
/28 = "TOWEL"
/29 = "BUTTER"
/30 = "BUTTON"
/31 = "CABBAGE"
/32 = "CACTUS"
/33 = "CAMEL"
/34 = "CANDY"
/35 = "CANOE"
/36 = "CANVAS"
/37 = "CARPET"
/38 = "CARROT"
/39 = "CARTON"
/40 = "CASTLE"
/41 = "CATTLE"
/42 = "CELLO"
/43 = "CHECKERS"
/44 = "CHEDDAR"
/45 = "CHERRY"
/46 = "CHICKEN"
/47 = "CHIPMUNK"
/48 = "CLOSET"
/49 = "COFFEE"
/50 = "COMPASS"
</item>

<list word>
</list>


<list paired_scene>
/ selectionmode = list.word.currentindex
</list>

<list unpaired_scene>
/ selectionmode = list.word.currentindex
</list>


<list unrelated_scene>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
/ not = (values.pairedpic_itemnumber)
/ not = (values.unpairedpic_itemnumber)
/ replace = true
/ selectionrate = always
</list>

<list xpos>
/ items = (20%, 50%, 80%)
/ selectionrate = always
</list>


<values>
/ p1 = 0
/ p2 = 0
/ p3 = 0
/ p4 = 0
/ p5 = 0
/ p6 = 0
/ p7 = 0
/ p8 = 0
/ p9 = 0
/ p10 = 0
/ p11 = 0
/ p12 = 0
/ p13 = 0
/ p14 = 0
/ p15 = 0
/ p16 = 0
/ pic_itemnumber = 1
/ pairedpic_itemnumber = 1
/ unpairedpic_itemnumber = 1
/ unrelatedpic_itemnumber = 1
/ noun_itemnumber = 1
/ paired_x = 0%
/ unpaired_x = 0%
/ unrelated_x = 0%
</values>

<picture p>
/ items = scenes
/ select = values.pic_itemnumber
/ position = (50%, 50%)
/ size = (60%, 60%)
</picture>

<picture pairedpic>
/ items = scenes
/ select = values.pairedpic_itemnumber
/ hposition = values.paired_x
/ vposition = 70%
/ size = (30%, 30%)
</picture>

<picture unpairedpic>
/ items = scenes
/ select = values.unpairedpic_itemnumber
/ hposition = values.unpaired_x
/ vposition = 70%
/ size = (30%, 30%)
</picture>


<picture unrelatedpic>
/ items = scenes
/ select = values.unrelatedpic_itemnumber
/ hposition = values.unrelated_x
/ vposition = 70%
/ size = (30%, 30%)
</picture>

list pic_items>
/ poolsize = 12
/ selectionrate = always
/ resetinterval = 0
</list>


<list pic_items>
/ poolsize = 16
/ selectionrate = always
/ selectionmode = sequence
</list>

<shape blank>
/ color = white
/ shape = rectangle
/ size = (100%, 100%)
/ erase = false
</shape>


<text belong>
/ items = ("Yes")
/ position = (70%, 80%)
/ size = (30%, 5%)
/ hjustify = center
/ vjustify = center
/ fontstyle = ("Arial", 18pt)
/ txbgcolor = white
/ erase = false
</text>


<text nobelong>
/ items = ("No")
/ position = (30%, 80%)
/ size = (30%, 5%)
/ hjustify = center
/ vjustify = center
/ fontstyle = ("Arial", 18pt)
/ txbgcolor = white
/ erase = false
</text>

#trials
<trial image1>
/ ontrialbegin = [
values.pic_itemnumber = values.p1;
values.noun_itemnumber = list.noun_items.nextindex;
list.paired_scene.appenditem(values.pic_itemnumber);
list.unpaired_scene.appenditem(values.p2);
list.word.appenditem(values.noun_itemnumber);
]
/ stimulustimes = [0 =p; 1000 = blank; 1500 = noun, belong, nobelong; 4000 = blank]
/ validresponse = ("n","m")
/ posttrialpause = 1000
/ trialduration = 5000
/ responseinterrupt = frames
/ beginresponsetime = 0
/ inputdevice = keyboard
</trial>


<trial image2>
/ ontrialbegin = [
values.pic_itemnumber = values.p2;
values.noun_itemnumber = list.noun_items.nextindex;
list.paired_scene.appenditem(values.pic_itemnumber);
list.unpaired_scene.appenditem(values.p1);
list.word.appenditem(values.noun_itemnumber);
]
/ stimulustimes = [0 =p; 1000 = blank; 1500 = noun, belong, nobelong; 4000 = blank]
/ validresponse = ("n","m")
/ posttrialpause = 1000
/ trialduration = 5000
/ responseinterrupt = frames
/ beginresponsetime = 0
/ inputdevice = keyboard
</trial>



<trial image3>
/ ontrialbegin = [
values.pic_itemnumber = values.p3;
values.noun_itemnumber = list.noun_items.nextindex;
list.paired_scene.appenditem(values.pic_itemnumber);
list.unpaired_scene.appenditem(values.p4);
list.word.appenditem(values.noun_itemnumber);
]

/ stimulustimes = [0 =p; 1000 = blank; 1500 = noun, belong, nobelong; 4000 = blank]
/ validresponse = ("n","m")
/ posttrialpause = 1000
/ trialduration = 5000
/ responseinterrupt = frames
/ beginresponsetime = 0
/ inputdevice = keyboard
</trial>

<trial image4>
/ ontrialbegin = [
values.pic_itemnumber = values.p4;
values.noun_itemnumber = list.noun_items.nextindex;
list.paired_scene.appenditem(values.pic_itemnumber);
list.unpaired_scene.appenditem(values.p3);
list.word.appenditem(values.noun_itemnumber);
]

/ stimulustimes = [0 =p; 1000 = blank; 1500 = noun, belong, nobelong; 4000 = blank]
/ validresponse = ("n","m")
/ posttrialpause = 1000
/ trialduration = 5000
/ responseinterrupt = frames
/ beginresponsetime = 0
/ inputdevice = keyboard
</trial>

#blocks 


<block test>
/ onblockbegin = [values.p1=list.pic_items.nextindex; values.p2=list.pic_items.nextindex;]
/ trials = [1-4 = image1; 5-8 = image2]
</block>


<block test2>
/ onblockbegin = [values.p3=list.pic_items.nextindex; values.p4=list.pic_items.nextindex;]
/ trials = [1-4 = image3; 5-8 = image4]
</block>

<expt>
/ blocks = [1-2 = noreplace(test, test2)]
</expt>

lir1995
lir1995
Partner Member (701 reputation)Partner Member (701 reputation)Partner Member (701 reputation)Partner Member (701 reputation)Partner Member (701 reputation)Partner Member (701 reputation)Partner Member (701 reputation)Partner Member (701 reputation)Partner Member (701 reputation)
Group: Forum Members
Posts: 40, Visits: 190
lir1995 - 6/25/2023
Hello, 

I am trying to show participants images, where within a single block, two of the images are pairs of highly similar images (e.g., two different pictures of airports). Each block contains 8 trials, where one unique image is presented 4 times with trial unique words before switching to a pairmate. I was able to generate code to show the images together in a block. In order to show the images in pairs, I was pulling them from a list sequentially.

However, this posed a couple of problems:
1) This experiment will have 8 blocks. As it stands images 1 and 2 will always be in block 1. I'd really love to be able to randomize the blocks so it is random which pair comes first
2) If possible, I'd also like to be able to randomize whether picture 1 or 2 comes first in the pair. But this is less of an issue, and okay if not resolved.

Do you have any ideas on how to help with this randomization issue? I assume I am missing some knowledge of lists, perhaps there is a way to group pairs of items while randomly selecting these pairs, or somehow do this using multiple lists. I included code below I have been working on. Thank you in advance for any guidance!!

I apologize I was not able to upload the actual scenes for space issues

Code:
<item scenes>
/1 = "Scenes/Airport 1.jpg"
/2 = "Scenes/Airport 2.jpg"
/3 = "Scenes/Train 1.jpg"
/4 = "Scenes/Train 2.jpg"
/5 = "Scenes/Soccer Field 1.jpg"
/6 = "Scenes/Soccer Field 2.jpg"
/7 = "Scenes/Street 1.jpg"
/8 = "Scenes/Street 2.jpg"
/9 = "Scenes/Pool 1.jpg"
/10 = "Scenes/Pool 2.jpg"
/11 = "Scenes/Museum 1.jpg"
/12 = "Scenes/Museum 2.jpeg"
/13 = "Scenes/Salon 1.jpg"
/14 = "Scenes/Salon 2.jpeg"
/15 = "Scenes/Dentist 1.jpg"
/16 = "Scenes/Dentist 2.jpeg"
</item>

<text noun>
/ items = noun
/ select = values.noun_itemnumber
/ position = (50,50)
/ fontstyle = ("Arial", 30pt)
/ erase = false
</text>

<list noun_items>
/ poolsize = 50
</list>

<item noun>
/1 = "ACORN"
/2 = "ANCHOR"
/3 = "APPLE"
/4 = "APRON"
/5 = "ARROW"
/6 = "BACON"
/7= "TOWER"
/8 = "TUBA"
/9 = "BANDAGE"
/10 = "BANJO"
/11 = "BARLEY"
/12 = "BARREL"
/13 = "BASEBALL"
/14 = "BEAKER"
/15 = "BEAVER"
/16 = "BEETLE"
/17 = "BERRY"
/18 = "BINDER"
/19 = "BISCUIT"
/20 = "BISON"
/21 = "BLACKBOARD"
/22 = "BLENDER"
/23 = "BOTTLE"
/24 = "BRACELET"
/25 = "BRIEFCASE"
/26 = "BUILDING"
/27 = "COOKBOOK"
/28 = "TOWEL"
/29 = "BUTTER"
/30 = "BUTTON"
/31 = "CABBAGE"
/32 = "CACTUS"
/33 = "CAMEL"
/34 = "CANDY"
/35 = "CANOE"
/36 = "CANVAS"
/37 = "CARPET"
/38 = "CARROT"
/39 = "CARTON"
/40 = "CASTLE"
/41 = "CATTLE"
/42 = "CELLO"
/43 = "CHECKERS"
/44 = "CHEDDAR"
/45 = "CHERRY"
/46 = "CHICKEN"
/47 = "CHIPMUNK"
/48 = "CLOSET"
/49 = "COFFEE"
/50 = "COMPASS"
</item>

<list word>
</list>


<list paired_scene>
/ selectionmode = list.word.currentindex
</list>

<list unpaired_scene>
/ selectionmode = list.word.currentindex
</list>


<list unrelated_scene>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
/ not = (values.pairedpic_itemnumber)
/ not = (values.unpairedpic_itemnumber)
/ replace = true
/ selectionrate = always
</list>

<list xpos>
/ items = (20%, 50%, 80%)
/ selectionrate = always
</list>


<values>
/ p1 = 0
/ p2 = 0
/ p3 = 0
/ p4 = 0
/ p5 = 0
/ p6 = 0
/ p7 = 0
/ p8 = 0
/ p9 = 0
/ p10 = 0
/ p11 = 0
/ p12 = 0
/ p13 = 0
/ p14 = 0
/ p15 = 0
/ p16 = 0
/ pic_itemnumber = 1
/ pairedpic_itemnumber = 1
/ unpairedpic_itemnumber = 1
/ unrelatedpic_itemnumber = 1
/ noun_itemnumber = 1
/ paired_x = 0%
/ unpaired_x = 0%
/ unrelated_x = 0%
</values>

<picture p>
/ items = scenes
/ select = values.pic_itemnumber
/ position = (50%, 50%)
/ size = (60%, 60%)
</picture>

<picture pairedpic>
/ items = scenes
/ select = values.pairedpic_itemnumber
/ hposition = values.paired_x
/ vposition = 70%
/ size = (30%, 30%)
</picture>

<picture unpairedpic>
/ items = scenes
/ select = values.unpairedpic_itemnumber
/ hposition = values.unpaired_x
/ vposition = 70%
/ size = (30%, 30%)
</picture>


<picture unrelatedpic>
/ items = scenes
/ select = values.unrelatedpic_itemnumber
/ hposition = values.unrelated_x
/ vposition = 70%
/ size = (30%, 30%)
</picture>

list pic_items>
/ poolsize = 12
/ selectionrate = always
/ resetinterval = 0
</list>


<list pic_items>
/ poolsize = 16
/ selectionrate = always
/ selectionmode = sequence
</list>

<shape blank>
/ color = white
/ shape = rectangle
/ size = (100%, 100%)
/ erase = false
</shape>


<text belong>
/ items = ("Yes")
/ position = (70%, 80%)
/ size = (30%, 5%)
/ hjustify = center
/ vjustify = center
/ fontstyle = ("Arial", 18pt)
/ txbgcolor = white
/ erase = false
</text>


<text nobelong>
/ items = ("No")
/ position = (30%, 80%)
/ size = (30%, 5%)
/ hjustify = center
/ vjustify = center
/ fontstyle = ("Arial", 18pt)
/ txbgcolor = white
/ erase = false
</text>

#trials
<trial image1>
/ ontrialbegin = [
values.pic_itemnumber = values.p1;
values.noun_itemnumber = list.noun_items.nextindex;
list.paired_scene.appenditem(values.pic_itemnumber);
list.unpaired_scene.appenditem(values.p2);
list.word.appenditem(values.noun_itemnumber);
]
/ stimulustimes = [0 =p; 1000 = blank; 1500 = noun, belong, nobelong; 4000 = blank]
/ validresponse = ("n","m")
/ posttrialpause = 1000
/ trialduration = 5000
/ responseinterrupt = frames
/ beginresponsetime = 0
/ inputdevice = keyboard
</trial>


<trial image2>
/ ontrialbegin = [
values.pic_itemnumber = values.p2;
values.noun_itemnumber = list.noun_items.nextindex;
list.paired_scene.appenditem(values.pic_itemnumber);
list.unpaired_scene.appenditem(values.p1);
list.word.appenditem(values.noun_itemnumber);
]
/ stimulustimes = [0 =p; 1000 = blank; 1500 = noun, belong, nobelong; 4000 = blank]
/ validresponse = ("n","m")
/ posttrialpause = 1000
/ trialduration = 5000
/ responseinterrupt = frames
/ beginresponsetime = 0
/ inputdevice = keyboard
</trial>



<trial image3>
/ ontrialbegin = [
values.pic_itemnumber = values.p3;
values.noun_itemnumber = list.noun_items.nextindex;
list.paired_scene.appenditem(values.pic_itemnumber);
list.unpaired_scene.appenditem(values.p4);
list.word.appenditem(values.noun_itemnumber);
]

/ stimulustimes = [0 =p; 1000 = blank; 1500 = noun, belong, nobelong; 4000 = blank]
/ validresponse = ("n","m")
/ posttrialpause = 1000
/ trialduration = 5000
/ responseinterrupt = frames
/ beginresponsetime = 0
/ inputdevice = keyboard
</trial>

<trial image4>
/ ontrialbegin = [
values.pic_itemnumber = values.p4;
values.noun_itemnumber = list.noun_items.nextindex;
list.paired_scene.appenditem(values.pic_itemnumber);
list.unpaired_scene.appenditem(values.p3);
list.word.appenditem(values.noun_itemnumber);
]

/ stimulustimes = [0 =p; 1000 = blank; 1500 = noun, belong, nobelong; 4000 = blank]
/ validresponse = ("n","m")
/ posttrialpause = 1000
/ trialduration = 5000
/ responseinterrupt = frames
/ beginresponsetime = 0
/ inputdevice = keyboard
</trial>

#blocks 


<block test>
/ onblockbegin = [values.p1=list.pic_items.nextindex; values.p2=list.pic_items.nextindex;]
/ trials = [1-4 = image1; 5-8 = image2]
</block>


<block test2>
/ onblockbegin = [values.p3=list.pic_items.nextindex; values.p4=list.pic_items.nextindex;]
/ trials = [1-4 = image3; 5-8 = image4]
</block>

<expt>
/ blocks = [1-2 = noreplace(test, test2)]
</expt>

In doing a bit more research and testing, I believe I was actually able to come up with a solution using code from a previous topic:
https://forums.millisecond.com/Topic25332.aspx

I was originally adapting code from an old experiment which I think was making it more complicated than it needed to be. Thanks!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search