Millisecond Forums

Automatically linking vposition and hposition

https://forums.millisecond.com/Topic22663.aspx

By Brabagazaa - 10/10/2017

Dear all,

I ran into a slight problem and could not find a straightforward solution on the forum. I am drawing multiple items on the screen for each trial, the horizontal positions are in a list and picked at random, however all the shape also need a vertical position and I could not see how to make a list with tuple, something like:
list = [(x1, y1), (x2, y2), etc]

At the moment I wrote an expression that checks all the possible horizontal positions and matches the correct vertical position to it, so that each picture has the correct combination of vertical position + horizontal position, I was wondering if there might be an easier way to combine these values? Any suggestions would be great,

Roelof

PS: Attached a simplified example that shows the basic structure, the actual experiment uses set sizes 5,7,9, with all different coordinates, at which point writing the expressions becomes more arduous
By Dave - 10/10/2017

Brabagazaa - Tuesday, October 10, 2017
Dear all,

I ran into a slight problem and could not find a straightforward solution on the forum. I am drawing multiple items on the screen for each trial, the horizontal positions are in a list and picked at random, however all the shape also need a vertical position and I could not see how to make a list with tuple, something like:
list = [(x1, y1), (x2, y2), etc]

At the moment I wrote an expression that checks all the possible horizontal positions and matches the correct vertical position to it, so that each picture has the correct combination of vertical position + horizontal position, I was wondering if there might be an easier way to combine these values? Any suggestions would be great,

Roelof

PS: Attached a simplified example that shows the basic structure, the actual experiment uses set sizes 5,7,9, with all different coordinates, at which point writing the expressions becomes more arduous

The trick is to define your position x/y tuples in two linked <list>s instead of trying to use a single one:

<list hposition_list_neutral_set7>
/items = (20, 26, 50, 73, 79, 63, 36)
/selectionmode = random
</list>

<list vposition_list_set7>
/items = (43, 68, 80, 68, 43, 22, 22)
/ selectionmode = list.hposition_list_neutral_set7.currentindex
</list>

with


<trial neutral>
/ontrialbegin = [values.hpos1 = list.hposition_list_neutral_set7.nextvalue;
                         values.vpos1=list.vposition_list_set7.nextvalue]
/stimulusframes = [1=target_shape]
/validresponse = ("z","m")
/pretrialpause = floor(rand(values.jitter_low,values.jitter_high))
</trial>

<picture target_shape>
/ items = c_g
/ hposition = values.hpos1
/ vposition = values.vpos1
</picture>
By Brabagazaa - 10/10/2017

Dave - Tuesday, October 10, 2017
Brabagazaa - Tuesday, October 10, 2017
Dear all,

I ran into a slight problem and could not find a straightforward solution on the forum. I am drawing multiple items on the screen for each trial, the horizontal positions are in a list and picked at random, however all the shape also need a vertical position and I could not see how to make a list with tuple, something like:
list = [(x1, y1), (x2, y2), etc]

At the moment I wrote an expression that checks all the possible horizontal positions and matches the correct vertical position to it, so that each picture has the correct combination of vertical position + horizontal position, I was wondering if there might be an easier way to combine these values? Any suggestions would be great,

Roelof

PS: Attached a simplified example that shows the basic structure, the actual experiment uses set sizes 5,7,9, with all different coordinates, at which point writing the expressions becomes more arduous

The trick is to define your position x/y tuples in two linked <list>s instead of trying to use a single one:

<list hposition_list_neutral_set7>
/items = (20, 26, 50, 73, 79, 63, 36)
/selectionmode = random
</list>

<list vposition_list_set7>
/items = (43, 68, 80, 68, 43, 22, 22)
/ selectionmode = list.hposition_list_neutral_set7.currentindex
</list>

with


<trial neutral>
/ontrialbegin = [values.hpos1 = list.hposition_list_neutral_set7.nextvalue;
                         values.vpos1=list.vposition_list_set7.nextvalue]
/stimulusframes = [1=target_shape]
/validresponse = ("z","m")
/pretrialpause = floor(rand(values.jitter_low,values.jitter_high))
</trial>

<picture target_shape>
/ items = c_g
/ hposition = values.hpos1
/ vposition = values.vpos1
</picture>

That was exaclty what I was looking for, thank you so much
By S F - 10/16/2017

Dave - Tuesday, October 10, 2017
Brabagazaa - Tuesday, October 10, 2017
Dear all,

I ran into a slight problem and could not find a straightforward solution on the forum. I am drawing multiple items on the screen for each trial, the horizontal positions are in a list and picked at random, however all the shape also need a vertical position and I could not see how to make a list with tuple, something like:
list = [(x1, y1), (x2, y2), etc]

At the moment I wrote an expression that checks all the possible horizontal positions and matches the correct vertical position to it, so that each picture has the correct combination of vertical position + horizontal position, I was wondering if there might be an easier way to combine these values? Any suggestions would be great,

Roelof

PS: Attached a simplified example that shows the basic structure, the actual experiment uses set sizes 5,7,9, with all different coordinates, at which point writing the expressions becomes more arduous

The trick is to define your position x/y tuples in two linked <list>s instead of trying to use a single one:

<list hposition_list_neutral_set7>
/items = (20, 26, 50, 73, 79, 63, 36)
/selectionmode = random
</list>

<list vposition_list_set7>
/items = (43, 68, 80, 68, 43, 22, 22)
/ selectionmode = list.hposition_list_neutral_set7.currentindex
</list>

with


<trial neutral>
/ontrialbegin = [values.hpos1 = list.hposition_list_neutral_set7.nextvalue;
                         values.vpos1=list.vposition_list_set7.nextvalue]
/stimulusframes = [1=target_shape]
/validresponse = ("z","m")
/pretrialpause = floor(rand(values.jitter_low,values.jitter_high))
</trial>

<picture target_shape>
/ items = c_g
/ hposition = values.hpos1
/ vposition = values.vpos1
</picture>

Hi,

I'm trying this approach but I can't get it to run- any tips? More generally, I wouldn't have to randomize positions if I could just evaluate whether the item randomly chosen from an element of items matched a string (for correctresponse) but since I couldn't figure that out, evaluating this from the picture name (fixing the picture) worked before, except that it's tricky to randomize position. That's what I'm trying to do in this code, attempting to match this example.

Thanks!
By S F - 10/16/2017

S F - Monday, October 16, 2017
Dave - Tuesday, October 10, 2017
Brabagazaa - Tuesday, October 10, 2017
Dear all,

I ran into a slight problem and could not find a straightforward solution on the forum. I am drawing multiple items on the screen for each trial, the horizontal positions are in a list and picked at random, however all the shape also need a vertical position and I could not see how to make a list with tuple, something like:
list = [(x1, y1), (x2, y2), etc]

At the moment I wrote an expression that checks all the possible horizontal positions and matches the correct vertical position to it, so that each picture has the correct combination of vertical position + horizontal position, I was wondering if there might be an easier way to combine these values? Any suggestions would be great,

Roelof

PS: Attached a simplified example that shows the basic structure, the actual experiment uses set sizes 5,7,9, with all different coordinates, at which point writing the expressions becomes more arduous

The trick is to define your position x/y tuples in two linked <list>s instead of trying to use a single one:

<list hposition_list_neutral_set7>
/items = (20, 26, 50, 73, 79, 63, 36)
/selectionmode = random
</list>

<list vposition_list_set7>
/items = (43, 68, 80, 68, 43, 22, 22)
/ selectionmode = list.hposition_list_neutral_set7.currentindex
</list>

with


<trial neutral>
/ontrialbegin = [values.hpos1 = list.hposition_list_neutral_set7.nextvalue;
                         values.vpos1=list.vposition_list_set7.nextvalue]
/stimulusframes = [1=target_shape]
/validresponse = ("z","m")
/pretrialpause = floor(rand(values.jitter_low,values.jitter_high))
</trial>

<picture target_shape>
/ items = c_g
/ hposition = values.hpos1
/ vposition = values.vpos1
</picture>

Hi,

I'm trying this approach but I can't get it to run- any tips? More generally, I wouldn't have to randomize positions if I could just evaluate whether the item randomly chosen from an element of items matched a string (for correctresponse) but since I couldn't figure that out, evaluating this from the picture name (fixing the picture) worked before, except that it's tricky to randomize position. That's what I'm trying to do in this code, attempting to match this example.

Thanks!

Whoops- I was missing declaring the <values> before. So it works now, but it displays 2 pictures in each spot, overlapping....
<values>
/ 1h = 0
/ 1v = 0
/ 2h = 0
/ 2v = 0
/ 3h = 0
/ 3v = 0
/ 4h = 0
/ 4v = 0
</values>

<trial test_pic_trial1>
/ ontrialbegin = [
values.1h = list.random_hposition1.nextvalue;
values.1v = list.random_vposition1.nextvalue;
values.2h = list.random_hposition1.nextvalue;
values.2v = list.random_vposition1.nextvalue;
values.3h = list.random_hposition1.nextvalue;
values.3v = list.random_vposition1.nextvalue;
values.4h = list.random_hposition1.nextvalue;
values.4v = list.random_vposition1.nextvalue;
]
/ stimulusframes=[1=correct1, incorrect1_2, incorrect1_3, incorrect1_4]
/ inputdevice=mouse
/ validresponse=(correct1, incorrect1_2, incorrect1_3, incorrect1_4)
/ correctresponse= (correct1)
</trial>

<block test1>
/trials = [1=test_pic_trial1]
</block>

<picture correct1>
/ items = ("cap1.jpg")
/ size = (213, 280)
/ position = (values.1h, values.1v)
</picture>

<picture incorrect1_2>
/ items = ("cappen.jpg")
/ size = (213, 280)
/ position = (values.2h, values.2v)
</picture>

<picture incorrect1_3>
/ items = ("bottlecap.jpg")
/ size = (213, 280)
/ position = (values.3h, values.3v)

</picture>

<picture incorrect1_4>
/ items = ("pear.jpg")
/ size = (213, 280)
/ position = (values.4h, values.4v)
</picture>

<list random_hposition1>
/ items = (25, 25, 75, 75)
/ selectionrate = always
/ selectionmode = random
/ replace = false
</list>

<list random_vposition1>
/ items = (25, 75, 75, 25)
/ selectionmode = list.random_hposition1.currentindex
</list>
By Dave - 10/16/2017

S F - Monday, October 16, 2017
S F - Monday, October 16, 2017
Dave - Tuesday, October 10, 2017
Brabagazaa - Tuesday, October 10, 2017
Dear all,

I ran into a slight problem and could not find a straightforward solution on the forum. I am drawing multiple items on the screen for each trial, the horizontal positions are in a list and picked at random, however all the shape also need a vertical position and I could not see how to make a list with tuple, something like:
list = [(x1, y1), (x2, y2), etc]

At the moment I wrote an expression that checks all the possible horizontal positions and matches the correct vertical position to it, so that each picture has the correct combination of vertical position + horizontal position, I was wondering if there might be an easier way to combine these values? Any suggestions would be great,

Roelof

PS: Attached a simplified example that shows the basic structure, the actual experiment uses set sizes 5,7,9, with all different coordinates, at which point writing the expressions becomes more arduous

The trick is to define your position x/y tuples in two linked <list>s instead of trying to use a single one:

<list hposition_list_neutral_set7>
/items = (20, 26, 50, 73, 79, 63, 36)
/selectionmode = random
</list>

<list vposition_list_set7>
/items = (43, 68, 80, 68, 43, 22, 22)
/ selectionmode = list.hposition_list_neutral_set7.currentindex
</list>

with


<trial neutral>
/ontrialbegin = [values.hpos1 = list.hposition_list_neutral_set7.nextvalue;
                         values.vpos1=list.vposition_list_set7.nextvalue]
/stimulusframes = [1=target_shape]
/validresponse = ("z","m")
/pretrialpause = floor(rand(values.jitter_low,values.jitter_high))
</trial>

<picture target_shape>
/ items = c_g
/ hposition = values.hpos1
/ vposition = values.vpos1
</picture>

Hi,

I'm trying this approach but I can't get it to run- any tips? More generally, I wouldn't have to randomize positions if I could just evaluate whether the item randomly chosen from an element of items matched a string (for correctresponse) but since I couldn't figure that out, evaluating this from the picture name (fixing the picture) worked before, except that it's tricky to randomize position. That's what I'm trying to do in this code, attempting to match this example.

Thanks!

Whoops- I was missing declaring the <values> before. So it works now, but it displays 2 pictures in each spot, overlapping....
<values>
/ 1h = 0
/ 1v = 0
/ 2h = 0
/ 2v = 0
/ 3h = 0
/ 3v = 0
/ 4h = 0
/ 4v = 0
</values>

<trial test_pic_trial1>
/ ontrialbegin = [
values.1h = list.random_hposition1.nextvalue;
values.1v = list.random_vposition1.nextvalue;
values.2h = list.random_hposition1.nextvalue;
values.2v = list.random_vposition1.nextvalue;
values.3h = list.random_hposition1.nextvalue;
values.3v = list.random_vposition1.nextvalue;
values.4h = list.random_hposition1.nextvalue;
values.4v = list.random_vposition1.nextvalue;
]
/ stimulusframes=[1=correct1, incorrect1_2, incorrect1_3, incorrect1_4]
/ inputdevice=mouse
/ validresponse=(correct1, incorrect1_2, incorrect1_3, incorrect1_4)
/ correctresponse= (correct1)
</trial>

<block test1>
/trials = [1=test_pic_trial1]
</block>

<picture correct1>
/ items = ("cap1.jpg")
/ size = (213, 280)
/ position = (values.1h, values.1v)
</picture>

<picture incorrect1_2>
/ items = ("cappen.jpg")
/ size = (213, 280)
/ position = (values.2h, values.2v)
</picture>

<picture incorrect1_3>
/ items = ("bottlecap.jpg")
/ size = (213, 280)
/ position = (values.3h, values.3v)

</picture>

<picture incorrect1_4>
/ items = ("pear.jpg")
/ size = (213, 280)
/ position = (values.4h, values.4v)
</picture>

<list random_hposition1>
/ items = (25, 25, 75, 75)
/ selectionrate = always
/ selectionmode = random
/ replace = false
</list>

<list random_vposition1>
/ items = (25, 75, 75, 25)
/ selectionmode = list.random_hposition1.currentindex
</list>

<list random_vposition1> must also be set to /selectionrate = always for this to work properly.

<list random_vposition1>
/ items = (25, 75, 75, 25)
/ selectionmode = list.random_hposition1.currentindex
/ selectionrate = always
</list>

By S F - 10/16/2017

Dave - Monday, October 16, 2017
S F - Monday, October 16, 2017
S F - Monday, October 16, 2017
Dave - Tuesday, October 10, 2017
Brabagazaa - Tuesday, October 10, 2017
Dear all,

I ran into a slight problem and could not find a straightforward solution on the forum. I am drawing multiple items on the screen for each trial, the horizontal positions are in a list and picked at random, however all the shape also need a vertical position and I could not see how to make a list with tuple, something like:
list = [(x1, y1), (x2, y2), etc]

At the moment I wrote an expression that checks all the possible horizontal positions and matches the correct vertical position to it, so that each picture has the correct combination of vertical position + horizontal position, I was wondering if there might be an easier way to combine these values? Any suggestions would be great,

Roelof

PS: Attached a simplified example that shows the basic structure, the actual experiment uses set sizes 5,7,9, with all different coordinates, at which point writing the expressions becomes more arduous

The trick is to define your position x/y tuples in two linked <list>s instead of trying to use a single one:

<list hposition_list_neutral_set7>
/items = (20, 26, 50, 73, 79, 63, 36)
/selectionmode = random
</list>

<list vposition_list_set7>
/items = (43, 68, 80, 68, 43, 22, 22)
/ selectionmode = list.hposition_list_neutral_set7.currentindex
</list>

with


<trial neutral>
/ontrialbegin = [values.hpos1 = list.hposition_list_neutral_set7.nextvalue;
                         values.vpos1=list.vposition_list_set7.nextvalue]
/stimulusframes = [1=target_shape]
/validresponse = ("z","m")
/pretrialpause = floor(rand(values.jitter_low,values.jitter_high))
</trial>

<picture target_shape>
/ items = c_g
/ hposition = values.hpos1
/ vposition = values.vpos1
</picture>

Hi,

I'm trying this approach but I can't get it to run- any tips? More generally, I wouldn't have to randomize positions if I could just evaluate whether the item randomly chosen from an element of items matched a string (for correctresponse) but since I couldn't figure that out, evaluating this from the picture name (fixing the picture) worked before, except that it's tricky to randomize position. That's what I'm trying to do in this code, attempting to match this example.

Thanks!

Whoops- I was missing declaring the <values> before. So it works now, but it displays 2 pictures in each spot, overlapping....
<values>
/ 1h = 0
/ 1v = 0
/ 2h = 0
/ 2v = 0
/ 3h = 0
/ 3v = 0
/ 4h = 0
/ 4v = 0
</values>

<trial test_pic_trial1>
/ ontrialbegin = [
values.1h = list.random_hposition1.nextvalue;
values.1v = list.random_vposition1.nextvalue;
values.2h = list.random_hposition1.nextvalue;
values.2v = list.random_vposition1.nextvalue;
values.3h = list.random_hposition1.nextvalue;
values.3v = list.random_vposition1.nextvalue;
values.4h = list.random_hposition1.nextvalue;
values.4v = list.random_vposition1.nextvalue;
]
/ stimulusframes=[1=correct1, incorrect1_2, incorrect1_3, incorrect1_4]
/ inputdevice=mouse
/ validresponse=(correct1, incorrect1_2, incorrect1_3, incorrect1_4)
/ correctresponse= (correct1)
</trial>

<block test1>
/trials = [1=test_pic_trial1]
</block>

<picture correct1>
/ items = ("cap1.jpg")
/ size = (213, 280)
/ position = (values.1h, values.1v)
</picture>

<picture incorrect1_2>
/ items = ("cappen.jpg")
/ size = (213, 280)
/ position = (values.2h, values.2v)
</picture>

<picture incorrect1_3>
/ items = ("bottlecap.jpg")
/ size = (213, 280)
/ position = (values.3h, values.3v)

</picture>

<picture incorrect1_4>
/ items = ("pear.jpg")
/ size = (213, 280)
/ position = (values.4h, values.4v)
</picture>

<list random_hposition1>
/ items = (25, 25, 75, 75)
/ selectionrate = always
/ selectionmode = random
/ replace = false
</list>

<list random_vposition1>
/ items = (25, 75, 75, 25)
/ selectionmode = list.random_hposition1.currentindex
</list>

<list random_vposition1> must also be set to /selectionrate = always for this to work properly.

<list random_vposition1>
/ items = (25, 75, 75, 25)
/ selectionmode = list.random_hposition1.currentindex
/ selectionrate = always
</list>


fantastic- works great. thanks so much Dave!