Placing mutiple items dynamically, with varying setsize


Author
Message
Brabagazaa
Brabagazaa
Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)
Group: Forum Members
Posts: 13, Visits: 79
Dave - Thursday, October 26, 2017
Brabagazaa - Thursday, October 26, 2017

Aha, right that makes, sense, however, if I set trial5 to the "wrong list", namely the list for trial3, the experiment still runs, even though the list only has 3 values, and picks without replacemant for 5 items. Does that mean that 2 of the positions will simply not be changed, and remain the default value 0? A bit of a nonesense question, but it would help woth understanding how the programs handles these situations since it does not throw an error.

<trial five>
/ ontrialbegin = [values.listnumber = 1; ==> instead of listnumber = 2


<trial five>
/ ontrialbegin = [values.listnumber = 1; ==> instead of listnumber = 2

In this case, the three positions in the 3-position list would be sampled without replacement, then the list would reset, i.e. all  3 positions become available again, and then two positions are sampled again (without replacement). At the end of the trial, one unsampled position would remain in the list. The position would be the 1st position sampled the next time a trial samples from that list.

Aha, that makes a lot of sence, thank you so much,


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: 104K
Brabagazaa - Thursday, October 26, 2017

Aha, right that makes, sense, however, if I set trial5 to the "wrong list", namely the list for trial3, the experiment still runs, even though the list only has 3 values, and picks without replacemant for 5 items. Does that mean that 2 of the positions will simply not be changed, and remain the default value 0? A bit of a nonesense question, but it would help woth understanding how the programs handles these situations since it does not throw an error.

<trial five>
/ ontrialbegin = [values.listnumber = 1; ==> instead of listnumber = 2


<trial five>
/ ontrialbegin = [values.listnumber = 1; ==> instead of listnumber = 2

In this case, the three positions in the 3-position list would be sampled without replacement, then the list would reset, i.e. all  3 positions become available again, and then two positions are sampled again (without replacement). At the end of the trial, one unsampled position would remain in the list. The position would be the 1st position sampled the next time a trial samples from that list.

Brabagazaa
Brabagazaa
Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)
Group: Forum Members
Posts: 13, Visits: 79
Dave - Thursday, October 26, 2017
Brabagazaa - Thursday, October 26, 2017
Dave - Wednesday, October 25, 2017
Brabagazaa - Wednesday, October 25, 2017
Hi all,
I am trying to build an experiment that places 9 items on the screen, one of which is a target and 8 of which are
'filler' items. The target can appear randomly at each location; and the filler items are placed around it in a circle, an example image in the attachment.
A complication is that sometimes the setsize will be 9 and at other times 7 or 5; this means that the position of the fillers changes
depending on the set size.

I have currently build a long 'if statement' for each filler item that check the position of the target and places the fillers around it, like so:

/ filler_position1 = if (values.hpos1==27) values.absolute_h_2_set5; if (values.hpos1==24) values.absolute_h_3_set5; etc
/ filler_position2 = if (values.hpos1==27) values.absolute_h_3_set5; if (values.hpos1==24) values.absolute_h_4_set5; etc
/ filler_position3 =
etc, etc
(hpos1 is the horizontal position of the target item which is chosen at random)

My question is if there is a more concise way to achieve the placement of these fillers, any suggestions welcome,

Roelof


You could use <list>s to assign positions, with one pair of <list>s for the 9-position case, one pair for the 7-position case, and finally one pair of <list>s for the 5-position case.
Note that you can "pipe through" or "nest" lists like so: https://www.millisecond.com/forums/FindPost20679.aspx

While the linked example concerns item selection, this would also work for positions:

<values>
/ listnumber = 1
/ t_h = 0
/ d1_h = 0
/ d2_h = 0
/ d3_h = 0
/ d4_h = 0
</values>

<block example>
/ trials = [1-10 = noreplace(three, five)]
</block>


<trial three>
/ ontrialbegin = [values.listnumber = 1;
    values.t_h = list.hpos.nextvalue;
    values.d1_h = list.hpos.nextvalue;
    values.d2_h = list.hpos.nextvalue;
]
/ stimulusframes = [1=t,d1,d2]
/ validresponse = (57)
</trial>


<trial five>
/ ontrialbegin = [values.listnumber = 2;
    values.t_h = list.hpos.nextvalue;
    values.d1_h = list.hpos.nextvalue;
    values.d2_h = list.hpos.nextvalue;
    values.d3_h = list.hpos.nextvalue;
    values.d4_h = list.hpos.nextvalue;
]
/ stimulusframes = [1=t,d1,d2,d3,d4]
/ validresponse = (57)
</trial>


<list hpos>
/ items = (list.3hpos.nextvalue, list.5hpos.nextvalue)
/ selectionmode = values.listnumber
/ selectionrate = always
</list>

//list #1: 3 horizontal positions
<list 3hpos>
/ items = (25%, 50%, 75%)
/ selectionrate = always
</list>

//list #2: 5 horizontal positions
<list 5hpos>
/ items = (30%, 40%, 50%, 60%, 70%)
/ selectionrate = always
</list>

//the target
<text t>
/ items = ("T")
/ hposition = values.t_h
</text>

//the distractors
<text d1>
/ items = ("D1")
/ hposition = values.d1_h
</text>

<text d2>
/ items = ("D2")
/ hposition = values.d2_h
</text>

<text d3>
/ items = ("D3")
/ hposition = values.d3_h
</text>

<text d4>
/ items = ("D4")
/ hposition = values.d4_h
</text>

As for linking x/y positions, the previous approach applies: https://www.millisecond.com/forums/FindPost22664.aspx

In other words: There should be no need for elaborate if-else logic, simple paired <list>s of x/y positions should suffice.

Hope this helps.

Hi Dave,
That looks very useful, thanks. Just to check my understanding:
- selectionmode in the list hpos differentiates between a setsize of either 3 or 5?
- how are positions chosen from one trial to the next? selection rate is set to always: does this mean one random choice per trial, after which the other items are chosen in sequential order?

if I try to 'break' the experiment by setting the listnumber for 5hpos to 1 (list only has 3 positions); the experiment does not crash, how are the positions now determined?

Lastly, just a general question, I was wondering if there are any more tutorials online: I know the tutorial by Ron Dotsch, but this does not address any of the somewhat more advanced operations, of course the forum is a great resource already, but it would be handy to go over some general principles, like the one you outline here.


Roelof


> - selectionmode in the list hpos differentiates between a setsize of either 3 or 5?

Yes, that is correct.

> - how are positions chosen from one trial to the next?

Positions are selected randomly without replacement, which is the <list> element's default behavior.

> if I try to 'break' the experiment by setting the listnumber for 5hpos to 1 (list only has 3 positions);
> the experiment does not crash, how are the positions now determined?

I don't understand this question. values.listnumber in

<list hpos>
/ items = (list.3hpos.nextvalue, list.5hpos.nextvalue)
/ selectionmode = values.listnumber
/ selectionrate = always
</list>

determines from which "sub-list" positions are sampled. If values.listnumnber is set to 1, sampling occurs from the 1st <list> listed in /items, here: <list 3hpos>. If values.listnumber is set to 2, sampling occurs from the 2nd <list> listed in /items, here: < list 5hpos>. You can change the order in /items as needed, and replace or add further sub-lists.

Aha, right that makes, sense, however, if I set trial5 to the "wrong list", namely the list for trial3, the experiment still runs, even though the list only has 3 values, and picks without replacemant for 5 items. Does that mean that 2 of the positions will simply not be changed, and remain the default value 0? A bit of a nonesense question, but it would help woth understanding how the programs handles these situations since it does not throw an error.

<trial five>
/ ontrialbegin = [values.listnumber = 1; ==> instead of listnumber = 2


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: 104K
Brabagazaa - Thursday, October 26, 2017
Dave - Wednesday, October 25, 2017
Brabagazaa - Wednesday, October 25, 2017
Hi all,
I am trying to build an experiment that places 9 items on the screen, one of which is a target and 8 of which are
'filler' items. The target can appear randomly at each location; and the filler items are placed around it in a circle, an example image in the attachment.
A complication is that sometimes the setsize will be 9 and at other times 7 or 5; this means that the position of the fillers changes
depending on the set size.

I have currently build a long 'if statement' for each filler item that check the position of the target and places the fillers around it, like so:

/ filler_position1 = if (values.hpos1==27) values.absolute_h_2_set5; if (values.hpos1==24) values.absolute_h_3_set5; etc
/ filler_position2 = if (values.hpos1==27) values.absolute_h_3_set5; if (values.hpos1==24) values.absolute_h_4_set5; etc
/ filler_position3 =
etc, etc
(hpos1 is the horizontal position of the target item which is chosen at random)

My question is if there is a more concise way to achieve the placement of these fillers, any suggestions welcome,

Roelof


You could use <list>s to assign positions, with one pair of <list>s for the 9-position case, one pair for the 7-position case, and finally one pair of <list>s for the 5-position case.
Note that you can "pipe through" or "nest" lists like so: https://www.millisecond.com/forums/FindPost20679.aspx

While the linked example concerns item selection, this would also work for positions:

<values>
/ listnumber = 1
/ t_h = 0
/ d1_h = 0
/ d2_h = 0
/ d3_h = 0
/ d4_h = 0
</values>

<block example>
/ trials = [1-10 = noreplace(three, five)]
</block>


<trial three>
/ ontrialbegin = [values.listnumber = 1;
    values.t_h = list.hpos.nextvalue;
    values.d1_h = list.hpos.nextvalue;
    values.d2_h = list.hpos.nextvalue;
]
/ stimulusframes = [1=t,d1,d2]
/ validresponse = (57)
</trial>


<trial five>
/ ontrialbegin = [values.listnumber = 2;
    values.t_h = list.hpos.nextvalue;
    values.d1_h = list.hpos.nextvalue;
    values.d2_h = list.hpos.nextvalue;
    values.d3_h = list.hpos.nextvalue;
    values.d4_h = list.hpos.nextvalue;
]
/ stimulusframes = [1=t,d1,d2,d3,d4]
/ validresponse = (57)
</trial>


<list hpos>
/ items = (list.3hpos.nextvalue, list.5hpos.nextvalue)
/ selectionmode = values.listnumber
/ selectionrate = always
</list>

//list #1: 3 horizontal positions
<list 3hpos>
/ items = (25%, 50%, 75%)
/ selectionrate = always
</list>

//list #2: 5 horizontal positions
<list 5hpos>
/ items = (30%, 40%, 50%, 60%, 70%)
/ selectionrate = always
</list>

//the target
<text t>
/ items = ("T")
/ hposition = values.t_h
</text>

//the distractors
<text d1>
/ items = ("D1")
/ hposition = values.d1_h
</text>

<text d2>
/ items = ("D2")
/ hposition = values.d2_h
</text>

<text d3>
/ items = ("D3")
/ hposition = values.d3_h
</text>

<text d4>
/ items = ("D4")
/ hposition = values.d4_h
</text>

As for linking x/y positions, the previous approach applies: https://www.millisecond.com/forums/FindPost22664.aspx

In other words: There should be no need for elaborate if-else logic, simple paired <list>s of x/y positions should suffice.

Hope this helps.

Hi Dave,
That looks very useful, thanks. Just to check my understanding:
- selectionmode in the list hpos differentiates between a setsize of either 3 or 5?
- how are positions chosen from one trial to the next? selection rate is set to always: does this mean one random choice per trial, after which the other items are chosen in sequential order?

if I try to 'break' the experiment by setting the listnumber for 5hpos to 1 (list only has 3 positions); the experiment does not crash, how are the positions now determined?

Lastly, just a general question, I was wondering if there are any more tutorials online: I know the tutorial by Ron Dotsch, but this does not address any of the somewhat more advanced operations, of course the forum is a great resource already, but it would be handy to go over some general principles, like the one you outline here.


Roelof


> - selectionmode in the list hpos differentiates between a setsize of either 3 or 5?

Yes, that is correct.

> - how are positions chosen from one trial to the next?

Positions are selected randomly without replacement, which is the <list> element's default behavior.

> if I try to 'break' the experiment by setting the listnumber for 5hpos to 1 (list only has 3 positions);
> the experiment does not crash, how are the positions now determined?

I don't understand this question. values.listnumber in

<list hpos>
/ items = (list.3hpos.nextvalue, list.5hpos.nextvalue)
/ selectionmode = values.listnumber
/ selectionrate = always
</list>

determines from which "sub-list" positions are sampled. If values.listnumnber is set to 1, sampling occurs from the 1st <list> listed in /items, here: <list 3hpos>. If values.listnumber is set to 2, sampling occurs from the 2nd <list> listed in /items, here: < list 5hpos>. You can change the order in /items as needed, and replace or add further sub-lists.

Brabagazaa
Brabagazaa
Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)
Group: Forum Members
Posts: 13, Visits: 79
Dave - Wednesday, October 25, 2017
Brabagazaa - Wednesday, October 25, 2017
Hi all,
I am trying to build an experiment that places 9 items on the screen, one of which is a target and 8 of which are
'filler' items. The target can appear randomly at each location; and the filler items are placed around it in a circle, an example image in the attachment.
A complication is that sometimes the setsize will be 9 and at other times 7 or 5; this means that the position of the fillers changes
depending on the set size.

I have currently build a long 'if statement' for each filler item that check the position of the target and places the fillers around it, like so:

/ filler_position1 = if (values.hpos1==27) values.absolute_h_2_set5; if (values.hpos1==24) values.absolute_h_3_set5; etc
/ filler_position2 = if (values.hpos1==27) values.absolute_h_3_set5; if (values.hpos1==24) values.absolute_h_4_set5; etc
/ filler_position3 =
etc, etc
(hpos1 is the horizontal position of the target item which is chosen at random)

My question is if there is a more concise way to achieve the placement of these fillers, any suggestions welcome,

Roelof


You could use <list>s to assign positions, with one pair of <list>s for the 9-position case, one pair for the 7-position case, and finally one pair of <list>s for the 5-position case.
Note that you can "pipe through" or "nest" lists like so: https://www.millisecond.com/forums/FindPost20679.aspx

While the linked example concerns item selection, this would also work for positions:

<values>
/ listnumber = 1
/ t_h = 0
/ d1_h = 0
/ d2_h = 0
/ d3_h = 0
/ d4_h = 0
</values>

<block example>
/ trials = [1-10 = noreplace(three, five)]
</block>


<trial three>
/ ontrialbegin = [values.listnumber = 1;
    values.t_h = list.hpos.nextvalue;
    values.d1_h = list.hpos.nextvalue;
    values.d2_h = list.hpos.nextvalue;
]
/ stimulusframes = [1=t,d1,d2]
/ validresponse = (57)
</trial>


<trial five>
/ ontrialbegin = [values.listnumber = 2;
    values.t_h = list.hpos.nextvalue;
    values.d1_h = list.hpos.nextvalue;
    values.d2_h = list.hpos.nextvalue;
    values.d3_h = list.hpos.nextvalue;
    values.d4_h = list.hpos.nextvalue;
]
/ stimulusframes = [1=t,d1,d2,d3,d4]
/ validresponse = (57)
</trial>


<list hpos>
/ items = (list.3hpos.nextvalue, list.5hpos.nextvalue)
/ selectionmode = values.listnumber
/ selectionrate = always
</list>

//list #1: 3 horizontal positions
<list 3hpos>
/ items = (25%, 50%, 75%)
/ selectionrate = always
</list>

//list #2: 5 horizontal positions
<list 5hpos>
/ items = (30%, 40%, 50%, 60%, 70%)
/ selectionrate = always
</list>

//the target
<text t>
/ items = ("T")
/ hposition = values.t_h
</text>

//the distractors
<text d1>
/ items = ("D1")
/ hposition = values.d1_h
</text>

<text d2>
/ items = ("D2")
/ hposition = values.d2_h
</text>

<text d3>
/ items = ("D3")
/ hposition = values.d3_h
</text>

<text d4>
/ items = ("D4")
/ hposition = values.d4_h
</text>

As for linking x/y positions, the previous approach applies: https://www.millisecond.com/forums/FindPost22664.aspx

In other words: There should be no need for elaborate if-else logic, simple paired <list>s of x/y positions should suffice.

Hope this helps.

Hi Dave,
That looks very useful, thanks. Just to check my understanding:
- selectionmode in the list hpos differentiates between a setsize of either 3 or 5?
- how are positions chosen from one trial to the next? selection rate is set to always: does this mean one random choice per trial, after which the other items are chosen in sequential order?

if I try to 'break' the experiment by setting the listnumber for 5hpos to 1 (list only has 3 positions); the experiment does not crash, how are the positions now determined?

Lastly, just a general question, I was wondering if there are any more tutorials online: I know the tutorial by Ron Dotsch, but this does not address any of the somewhat more advanced operations, of course the forum is a great resource already, but it would be handy to go over some general principles, like the one you outline here.


Roelof


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: 104K
Brabagazaa - Wednesday, October 25, 2017
Hi all,
I am trying to build an experiment that places 9 items on the screen, one of which is a target and 8 of which are
'filler' items. The target can appear randomly at each location; and the filler items are placed around it in a circle, an example image in the attachment.
A complication is that sometimes the setsize will be 9 and at other times 7 or 5; this means that the position of the fillers changes
depending on the set size.

I have currently build a long 'if statement' for each filler item that check the position of the target and places the fillers around it, like so:

/ filler_position1 = if (values.hpos1==27) values.absolute_h_2_set5; if (values.hpos1==24) values.absolute_h_3_set5; etc
/ filler_position2 = if (values.hpos1==27) values.absolute_h_3_set5; if (values.hpos1==24) values.absolute_h_4_set5; etc
/ filler_position3 =
etc, etc
(hpos1 is the horizontal position of the target item which is chosen at random)

My question is if there is a more concise way to achieve the placement of these fillers, any suggestions welcome,

Roelof


You could use <list>s to assign positions, with one pair of <list>s for the 9-position case, one pair for the 7-position case, and finally one pair of <list>s for the 5-position case.
Note that you can "pipe through" or "nest" lists like so: https://www.millisecond.com/forums/FindPost20679.aspx

While the linked example concerns item selection, this would also work for positions:

<values>
/ listnumber = 1
/ t_h = 0
/ d1_h = 0
/ d2_h = 0
/ d3_h = 0
/ d4_h = 0
</values>

<block example>
/ trials = [1-10 = noreplace(three, five)]
</block>


<trial three>
/ ontrialbegin = [values.listnumber = 1;
    values.t_h = list.hpos.nextvalue;
    values.d1_h = list.hpos.nextvalue;
    values.d2_h = list.hpos.nextvalue;
]
/ stimulusframes = [1=t,d1,d2]
/ validresponse = (57)
</trial>


<trial five>
/ ontrialbegin = [values.listnumber = 2;
    values.t_h = list.hpos.nextvalue;
    values.d1_h = list.hpos.nextvalue;
    values.d2_h = list.hpos.nextvalue;
    values.d3_h = list.hpos.nextvalue;
    values.d4_h = list.hpos.nextvalue;
]
/ stimulusframes = [1=t,d1,d2,d3,d4]
/ validresponse = (57)
</trial>


<list hpos>
/ items = (list.3hpos.nextvalue, list.5hpos.nextvalue)
/ selectionmode = values.listnumber
/ selectionrate = always
</list>

//list #1: 3 horizontal positions
<list 3hpos>
/ items = (25%, 50%, 75%)
/ selectionrate = always
</list>

//list #2: 5 horizontal positions
<list 5hpos>
/ items = (30%, 40%, 50%, 60%, 70%)
/ selectionrate = always
</list>

//the target
<text t>
/ items = ("T")
/ hposition = values.t_h
</text>

//the distractors
<text d1>
/ items = ("D1")
/ hposition = values.d1_h
</text>

<text d2>
/ items = ("D2")
/ hposition = values.d2_h
</text>

<text d3>
/ items = ("D3")
/ hposition = values.d3_h
</text>

<text d4>
/ items = ("D4")
/ hposition = values.d4_h
</text>

As for linking x/y positions, the previous approach applies: https://www.millisecond.com/forums/FindPost22664.aspx

In other words: There should be no need for elaborate if-else logic, simple paired <list>s of x/y positions should suffice.

Hope this helps.

Brabagazaa
Brabagazaa
Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)
Group: Forum Members
Posts: 13, Visits: 79
Hi all,
I am trying to build an experiment that places 9 items on the screen, one of which is a target and 8 of which are
'filler' items. The target can appear randomly at each location; and the filler items are placed around it in a circle, an example image in the attachment.
A complication is that sometimes the setsize will be 9 and at other times 7 or 5; this means that the position of the fillers changes
depending on the set size.

I have currently build a long 'if statement' for each filler item that check the position of the target and places the fillers around it, like so:

/ filler_position1 = if (values.hpos1==27) values.absolute_h_2_set5; if (values.hpos1==24) values.absolute_h_3_set5; etc
/ filler_position2 = if (values.hpos1==27) values.absolute_h_3_set5; if (values.hpos1==24) values.absolute_h_4_set5; etc
/ filler_position3 =
etc, etc
(hpos1 is the horizontal position of the target item which is chosen at random)

My question is if there is a more concise way to achieve the placement of these fillers, any suggestions welcome,

Roelof


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search