Select and present pictures without repetition


Author
Message
nfbecker
nfbecker
New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)
Group: Forum Members
Posts: 6, Visits: 28
Hi! I'm trying to program a learning phase within my experiment and am stuck - maybe someone has an idea?
I want to present 36 statements together with each 1 out of 18 images, so each image is presented twice. The 18 images should consist of 3 a-images, 3 b-images, 3 c-images, 9 d-images. The a/b/c/d images should be selected from an itempool of 10 a/b/c/d images.
Sofar I select 3 pictures with noreplacenorepeat out of an itempool, as a1 a2 a3 should be distinct. Within each trial I present the text together with one picture, again noreplacenorepeat, as I thought that that way each picture is selected one time, and then when all 18 have been presented, each is selected once again - so exactly what I want. But that doesn't work: Some pictures are presented twice before the others have been presented at all - and some pictures are presented more than twice, some only once or not at all. Do you have any ideas where my thoughts are twisted, should that not be taken care of by noreplacenorepeat?
Thank you for your help!

Here an excerpt of my script:

<item item_old>
/ 1 = "text1"
/ 2 = "text2"
/ 3 = "text3"
/ 4 = "text4"
/ 5 = "text5"
/ 6 = "text6"
/ 7 = "text7"
/ 8 = "text8"
/ 9 = "text9"
/ 10 = "text10"
/ 11 = "text11"
/ 12 = "text12"
/ 13 = "text13"
/ 14 = "text14"
/ 15 = "text15"
/ 16 = "text16"
/ 17 = "text17"
/ 18 = "text18"
/ 19 = "text19"
/ 20 = "text20"
/ 21 = "text21"
/ 22 = "text22"
/ 23 = "text23"
/ 24 = "text24"
/ 25 = "text25"
/ 26 = "text26"
/ 27 = "text27"
/ 28 = "text28"
/ 29 = "text29"
/ 30 = "text10"
/ 31 = "text31"
/ 32 = "text32"
/ 33 = "text33"
/ 34 = "text34"
/ 35 = "text35"
/ 36 = "text36"
</item>
<text t_old>
/ items = item_old
/ position = (50,50)
/ select = sequence
</text>

<item pic_a>
/1 = "a01.jpg"
/2 = "a02.jpg"
/3 = "a03.jpg"
/4 = "a04.jpg"
/5 = "a05.jpg"
/6 = "a06.jpg"
/7 = "a07.jpg"
/8 = "a08.jpg"
/9 = "a09.jpg"
/10 = "a10.jpg"
</item>
<picture pic01_a >
/ items = pic_a
/ select = noreplacenorepeat
/ selectionrate = experiment
/ position = (50, 30)
</picture>
<picture pic02_a>
/ items = pic_a
/ select = noreplacenorepeat
/ selectionrate = experiment
/ position = (50, 30)
</picture>
<picture pic03_a >
/ items = pic_a
/ select = noreplacenorepeat
/ selectionrate = experiment
/ position = (50, 30)
</picture>

<item pic_b>
/1 = "b01.jpg"
/2 = "b02.jpg"
/3 = "b03.jpg"
/4 = "b04.jpg"
/5 = "b05.jpg"
/6 = "b06.jpg"
/7 = "b07.jpg"
/8 = "b08.jpg"
/9 = "b09.jpg"
/10 = "b10.jpg"
</item>
<picture pic01_b >
/ items = pic_b
/ select = noreplacenorepeat
/ selectionrate = experiment
/ position = (50, 30)
</picture>
<picture pic02_b>
/ items = pic_b
/ select = noreplacenorepeat
/ selectionrate = experiment
/ position = (50, 30)
</picture>
<picture pic03_b >
/ items = pic_b
/ select = noreplacenorepeat
/ selectionrate = experiment
/ position = (50, 30)
</picture>

<item pic_c>
/1 = "c01.jpg"
/2 = "c02.jpg"
/3 = "c03.jpg"
/4 = "c04.jpg"
/5 = "c05.jpg"
/6 = "c06.jpg"
/7 = "c07.jpg"
/8 = "c08.jpg"
/9 = "c09.jpg"
/10 = "c10.jpg"
</item>
<picture pic01_c >
/ items = pic_c
/ select = noreplacenorepeat
/ selectionrate = experiment
/ position = (50, 30)
</picture>
<picture pic02_c>
/ items = pic_c
/ select = noreplacenorepeat
/ selectionrate = experiment
/ position = (50, 30)
</picture>
<picture pic03_c >
/ items = pic_c
/ select = noreplacenorepeat
/ selectionrate = experiment
/ position = (50, 30)
</picture>

<item pid_d>
/1 = "d01.jpg"
/2 = "d02.jpg"
/3 = "d03.jpg"
/4 = "d04.jpg"
/5 = "d05.jpg"
/6 = "d06.jpg"
/7 = "d07.jpg"
/8 = "d08.jpg"
/9 = "d09.jpg"
/10 = "d10.jpg"
</item>
<picture pid01_d >
/ items = pid_d
/ select = noreplacenorepeat
/ selectionrate = experiment
/ position = (50, 30)
</picture>
<picture pid02_d >
/ items = pid_d
/ select = noreplacenorepeat
/ selectionrate = experiment
/ position = (50, 30)
</picture>
<picture pid03_d >
/ items = pid_d
/ select = noreplacenorepeat
/ selectionrate = experiment
/ position = (50, 30)
</picture>

<trial t_learn>
/ stimulusframes = [1 = t_old;
2 = noreplacenorepeat(pic01_a, pic02_a, pic03_a, pic01_b, pic02_b, pic03_b, pic01_c, pic02_c, pic03_c, pic01_d, pic02_d, pic03_d, pic04_d, pic05_d, pic06_d, pic07_d, pic08_d, pic09_d)]
/ timeout = 100
</trial>

<block b_learn>
/ trials = [1-36 = t_learn]
</block>



Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 108K
nfbecker - 6/16/2025
Hi! I'm trying to program a learning phase within my experiment and am stuck - maybe someone has an idea?
I want to present 36 statements together with each 1 out of 18 images, so each image is presented twice. The 18 images should consist of 3 a-images, 3 b-images, 3 c-images, 9 d-images. The a/b/c/d images should be selected from an itempool of 10 a/b/c/d images.
Sofar I select 3 pictures with noreplacenorepeat out of an itempool, as a1 a2 a3 should be distinct. Within each trial I present the text together with one picture, again noreplacenorepeat, as I thought that that way each picture is selected one time, and then when all 18 have been presented, each is selected once again - so exactly what I want. But that doesn't work: Some pictures are presented twice before the others have been presented at all - and some pictures are presented more than twice, some only once or not at all. Do you have any ideas where my thoughts are twisted, should that not be taken care of by noreplacenorepeat?
Thank you for your help!

Here an excerpt of my script:

<item item_old>
/ 1 = "text1"
/ 2 = "text2"
/ 3 = "text3"
/ 4 = "text4"
/ 5 = "text5"
/ 6 = "text6"
/ 7 = "text7"
/ 8 = "text8"
/ 9 = "text9"
/ 10 = "text10"
/ 11 = "text11"
/ 12 = "text12"
/ 13 = "text13"
/ 14 = "text14"
/ 15 = "text15"
/ 16 = "text16"
/ 17 = "text17"
/ 18 = "text18"
/ 19 = "text19"
/ 20 = "text20"
/ 21 = "text21"
/ 22 = "text22"
/ 23 = "text23"
/ 24 = "text24"
/ 25 = "text25"
/ 26 = "text26"
/ 27 = "text27"
/ 28 = "text28"
/ 29 = "text29"
/ 30 = "text10"
/ 31 = "text31"
/ 32 = "text32"
/ 33 = "text33"
/ 34 = "text34"
/ 35 = "text35"
/ 36 = "text36"
</item>
<text t_old>
/ items = item_old
/ position = (50,50)
/ select = sequence
</text>

<item pic_a>
/1 = "a01.jpg"
/2 = "a02.jpg"
/3 = "a03.jpg"
/4 = "a04.jpg"
/5 = "a05.jpg"
/6 = "a06.jpg"
/7 = "a07.jpg"
/8 = "a08.jpg"
/9 = "a09.jpg"
/10 = "a10.jpg"
</item>
<picture pic01_a >
/ items = pic_a
/ select = noreplacenorepeat
/ selectionrate = experiment
/ position = (50, 30)
</picture>
<picture pic02_a>
/ items = pic_a
/ select = noreplacenorepeat
/ selectionrate = experiment
/ position = (50, 30)
</picture>
<picture pic03_a >
/ items = pic_a
/ select = noreplacenorepeat
/ selectionrate = experiment
/ position = (50, 30)
</picture>

<item pic_b>
/1 = "b01.jpg"
/2 = "b02.jpg"
/3 = "b03.jpg"
/4 = "b04.jpg"
/5 = "b05.jpg"
/6 = "b06.jpg"
/7 = "b07.jpg"
/8 = "b08.jpg"
/9 = "b09.jpg"
/10 = "b10.jpg"
</item>
<picture pic01_b >
/ items = pic_b
/ select = noreplacenorepeat
/ selectionrate = experiment
/ position = (50, 30)
</picture>
<picture pic02_b>
/ items = pic_b
/ select = noreplacenorepeat
/ selectionrate = experiment
/ position = (50, 30)
</picture>
<picture pic03_b >
/ items = pic_b
/ select = noreplacenorepeat
/ selectionrate = experiment
/ position = (50, 30)
</picture>

<item pic_c>
/1 = "c01.jpg"
/2 = "c02.jpg"
/3 = "c03.jpg"
/4 = "c04.jpg"
/5 = "c05.jpg"
/6 = "c06.jpg"
/7 = "c07.jpg"
/8 = "c08.jpg"
/9 = "c09.jpg"
/10 = "c10.jpg"
</item>
<picture pic01_c >
/ items = pic_c
/ select = noreplacenorepeat
/ selectionrate = experiment
/ position = (50, 30)
</picture>
<picture pic02_c>
/ items = pic_c
/ select = noreplacenorepeat
/ selectionrate = experiment
/ position = (50, 30)
</picture>
<picture pic03_c >
/ items = pic_c
/ select = noreplacenorepeat
/ selectionrate = experiment
/ position = (50, 30)
</picture>

<item pid_d>
/1 = "d01.jpg"
/2 = "d02.jpg"
/3 = "d03.jpg"
/4 = "d04.jpg"
/5 = "d05.jpg"
/6 = "d06.jpg"
/7 = "d07.jpg"
/8 = "d08.jpg"
/9 = "d09.jpg"
/10 = "d10.jpg"
</item>
<picture pid01_d >
/ items = pid_d
/ select = noreplacenorepeat
/ selectionrate = experiment
/ position = (50, 30)
</picture>
<picture pid02_d >
/ items = pid_d
/ select = noreplacenorepeat
/ selectionrate = experiment
/ position = (50, 30)
</picture>
<picture pid03_d >
/ items = pid_d
/ select = noreplacenorepeat
/ selectionrate = experiment
/ position = (50, 30)
</picture>

<trial t_learn>
/ stimulusframes = [1 = t_old;
2 = noreplacenorepeat(pic01_a, pic02_a, pic03_a, pic01_b, pic02_b, pic03_b, pic01_c, pic02_c, pic03_c, pic01_d, pic02_d, pic03_d, pic04_d, pic05_d, pic06_d, pic07_d, pic08_d, pic09_d)]
/ timeout = 100
</trial>

<block b_learn>
/ trials = [1-36 = t_learn]
</block>



You should never ever use selectionmodes in /stimuluframes. Your approach is also fundamentally flawed, because nothing prevents picture.pic02_a from randomly selecitng the same item as picture.pic01_a and so forth. These are all independent, they don't know or care what was selected for any of the other picture elemens.

If you want to do this right, you need to select the item numbers you are going to use from the overall pool at the start.

// NOTE: THIS IS IQX SYNTAX

<item item_old>
/ 1 = "text1"
/ 2 = "text2"
/ 3 = "text3"
/ 4 = "text4"
/ 5 = "text5"
/ 6 = "text6"
/ 7 = "text7"
/ 8 = "text8"
/ 9 = "text9"
/ 10 = "text10"
/ 11 = "text11"
/ 12 = "text12"
/ 13 = "text13"
/ 14 = "text14"
/ 15 = "text15"
/ 16 = "text16"
/ 17 = "text17"
/ 18 = "text18"
/ 19 = "text19"
/ 20 = "text20"
/ 21 = "text21"
/ 22 = "text22"
/ 23 = "text23"
/ 24 = "text24"
/ 25 = "text25"
/ 26 = "text26"
/ 27 = "text27"
/ 28 = "text28"
/ 29 = "text29"
/ 30 = "text10"
/ 31 = "text31"
/ 32 = "text32"
/ 33 = "text33"
/ 34 = "text34"
/ 35 = "text35"
/ 36 = "text36"
</item>

<text t_old>
/ items = item_old
/ position = (50,50)
/ select = sequence
</text>

<item allItems>
// items 1 to 10 are A
/1 = "a01.jpg"
/2 = "a02.jpg"
/3 = "a03.jpg"
/4 = "a04.jpg"
/5 = "a05.jpg"
/6 = "a06.jpg"
/7 = "a07.jpg"
/8 = "a08.jpg"
/9 = "a09.jpg"
/10 = "a10.jpg"
// items 11 to 20 are B
/11 = "b01.jpg"
/12 = "b02.jpg"
/13 = "b03.jpg"
/14 = "b04.jpg"
/15 = "b05.jpg"
/16 = "b06.jpg"
/17 = "b07.jpg"
/18 = "b08.jpg"
/19 = "b09.jpg"
/20 = "b10.jpg"
// items 21 to 30 are C
/21 = "c01.jpg"
/22 = "c02.jpg"
/23 = "c03.jpg"
/24 = "c04.jpg"
/25 = "c05.jpg"
/26 = "c06.jpg"
/27 = "c07.jpg"
/28 = "c08.jpg"
/29 = "c09.jpg"
/30 = "c10.jpg"
// items 31 to 40 are D
/31 = "d01.jpg"
/32 = "d02.jpg"
/33 = "d03.jpg"
/34 = "d04.jpg"
/35 = "d05.jpg"
/36 = "d06.jpg"
/37 = "d07.jpg"
/38 = "d08.jpg"
/39 = "d09.jpg"
/40 = "d10.jpg"
</item>

<picture pic>
/ items = allItems
/ position = (50,50)
/ select = list.selectedItemNumbers.nextvalue
</picture>

<trial t_learn>
/ stimulusframes = [1 = t_old, pic]
/ timeout = 100
</trial>

<block b_learn>
/ onBlockBegin = [
    var i = 0;
    // pick 3 item numbers from A
    while (i < 3) {
        list.selectedItemNumbers.appendItem(list.aItemnumbers.nextValue);
        i += 1;
    };
    i = 0;
    // pick 3 item numbers from B
    while (i < 3) {
        list.selectedItemNumbers.appendItem(list.bItemnumbers.nextValue);
        i += 1;
    };
    i = 0;
    // pick 3 item numbers from C
    while (i < 3) {
        list.selectedItemNumbers.appendItem(list.cItemnumbers.nextValue);
        i += 1;
    };
    i = 0;
    // pick 9 item numbers from D
        while (i < 9) {
        list.selectedItemNumbers.appendItem(list.dItemnumbers.nextValue);
        i += 1;
    };
]
/ trials = [1-36 = t_learn]
</block>

// list will hold the item numbers you picked at the start of the block
<list selectedItemNumbers>
/ poolSize = 18 // alternatively set to 36
</list>

<list aItemnumbers>
/ items = (1-10)
/ selectionRate = always
</list>

<list bItemnumbers>
/ items = (11-20)
/ selectionRate = always
</list>

<list cItemnumbers>
/ items = (21-30)
/ selectionRate = always
</list>

<list dItemnumbers>
/ items = (31-40)
/ selectionRate = always
</list>


Tasks like this -- old/new paradigms and the like -- have been discussed on the forums many, many times before. You can find numerous other examples via search.

Edited 6 days ago @ 3:36 AM by Dave
nfbecker
nfbecker
New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)
Group: Forum Members
Posts: 6, Visits: 28
Hello Dave, thank you so much for your quick reply and for sharing the script - I am really grateful!
I now see, that using <list> is the way to go! However, when I run your script, I notice that it’s not always selecting exactly 3 a/b/c and 9 d-images. Some images are repeated more than twice, so, not presented once during the first 18 and once again during the second 18 trials.
I’ve been trying around with settings in the onBlockBegin instructions and in the list elements (e.g., wondering if each list.a/b/c/dItemnumbers should have a defined poolSizes as well, or if setting selectionRate = experiment might provide same lists/items throughout?), I’ve read through the forum posts and the manual - but none of my adjustments have fixed the issue. Maybe, could you point me towards what might be going wrong, what I should look into more deeply? Thank you again!

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 108K
nfbecker - 6/17/2025
Hello Dave, thank you so much for your quick reply and for sharing the script - I am really grateful!
I now see, that using <list> is the way to go! However, when I run your script, I notice that it’s not always selecting exactly 3 a/b/c and 9 d-images. Some images are repeated more than twice, so, not presented once during the first 18 and once again during the second 18 trials.
I’ve been trying around with settings in the onBlockBegin instructions and in the list elements (e.g., wondering if each list.a/b/c/dItemnumbers should have a defined poolSizes as well, or if setting selectionRate = experiment might provide same lists/items throughout?), I’ve read through the forum posts and the manual - but none of my adjustments have fixed the issue. Maybe, could you point me towards what might be going wrong, what I should look into more deeply? Thank you again!

> Some images are repeated more than twice, so, not presented once during the first 18 and once again during the second 18 trials.

The script does exactly that, see attached data file. If you see something else, please provide the data to illustrate it.
Attachments
nfbecker
nfbecker
New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)
Group: Forum Members
Posts: 6, Visits: 28
Yes true, your file looks perfect! But in mine a01 (most often a01 but also other a images) is presented very often. Attached the data file for when I copy and run your script...

Attachments
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 108K
nfbecker - 6/17/2025
Yes true, your file looks perfect! But in mine a01 (most often a01 but also other a images) is presented very often. Attached the data file for when I copy and run your script...

Attach the actual script you are running, exactly as you are running it.
nfbecker
nfbecker
New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)
Group: Forum Members
Posts: 6, Visits: 28
Dave - 6/17/2025
nfbecker - 6/17/2025
Yes true, your file looks perfect! But in mine a01 (most often a01 but also other a images) is presented very often. Attached the data file for when I copy and run your script...

Attach the actual script you are running, exactly as you are running it.

What I did notice now, is that I still use Inquisit 6 - could that be the reason for differences? 
Attachments
experiment_dave.iqx (8 views, 2.00 KB)
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 108K
nfbecker - 6/17/2025
Dave - 6/17/2025
nfbecker - 6/17/2025
Yes true, your file looks perfect! But in mine a01 (most often a01 but also other a images) is presented very often. Attached the data file for when I copy and run your script...

Attach the actual script you are running, exactly as you are running it.

What I did notice now, is that I still use Inquisit 6 - could that be the reason for differences? 

Yes. If you wanted something for Inquisit 6, you should have posted in the Inquisit 6 section of the forum.

To work under Inquisit 6, the code has to be adjusted slightly. Remove the /poolsize attrbute from <list selectedItemNumbers> (since you want an 18/18 split, you don't need it anyway).
nfbecker
nfbecker
New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)New Member (23 reputation)
Group: Forum Members
Posts: 6, Visits: 28
Thank you so much Dave!!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search