Millisecond Forums

Issue with Overlapping Locations

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

By ldb24 - 9/18/2019

I'm working on a task that will show either 4, 5, or 8 colored squares on the screen. I'm having an issue though with the location assignment as occasionally I will get a trial with 3, 5, or 7 items (though I did get one 2). I figured out that on some trials items are getting assigned to the same location. 

Thing is I've been using some variant of this script for a while and never had the issue. I've modeled it after the ChangeBlindness script on the task library and I think I have everything set up the same way. The relevant bits are:

<values>
/column1_x = 45%
/column2_x = 50%
/column3_x = 55%
/column4_x = 60%
/row1_y = 45%
/row2_y = 50%
/row3_y = 55%

/object1_x = 0
/object2_x = 0
/object3_x = 0
/object4_x = 0
/object5_x = 0
/object6_x = 0
/object7_x = 0
/object8_x = 0

/object1_y = 0
/object2_y = 0
/object3_y = 0
/object4_y = 0
/object5_y = 0
/object6_y = 0
/object7_y = 0
/object8_y = 0
</values>

<picture object1>
/items = objects
/select = values.object1
/hposition = values.object1_x
/vposition = values.object1_y
/size = (20,20)
</picture>

<picture object2>
/items = objects
/select = values.object2
/hposition = values.object2_x
/vposition = values.object2_y
/size = (20,20)
</picture>

<picture object3>
/items = objects
/select = values.object3
/hposition = values.object3_x
/vposition = values.object3_y
/size = (20,20)
</picture>

<picture object4>
/items = objects
/select = values.object4
/hposition = values.object4_x
/vposition = values.object4_y
/size = (20,20)
</picture>

<picture object5>
/items = objects
/select = values.object5
/hposition = values.object5_x
/vposition = values.object5_y
/size = (20,20)
</picture>

<picture object6>
/items = objects
/select = values.object6
/hposition = values.object6_x
/vposition = values.object6_y
/size = (20,20)
</picture>

<picture object7>
/items = objects
/select = values.object7
/hposition = values.object7_x
/vposition = values.object7_y
/size = (20,20)
</picture>

<picture object8>
/items = objects
/select = values.object8
/hposition = values.object8_x
/vposition = values.object8_y
/size = (20,20)
</picture>

<list screencoordinates_x>
/items = (values.column1_x, values.column1_x, values.column1_x,
values.column2_x, values.column2_x, values.column2_x,
values.column3_x, values.column3_x, values.column3_x,
values.column4_x, values.column4_x, values.column4_x)
/replace = false
/selectionrate = always
</list>

<list screencoordinates_y>
/items = (values.row1_y, values.row2_y, values.row3_y, values.row4_y,
values.row1_y, values.row2_y, values.row3_y, values.row4_y,
values.row1_y, values.row2_y, values.row3_y, values.row4_y)
/ selectionmode= list.screencoordinates_x.currentindex
/ selectionrate = always
</list>

<trial createarray>
/ontrialbegin = [if (values.numberofobjects >= 1) {values.object1 = list.arrayobjects.nextvalue; values.object1_x = list.screencoordinates_x.nextvalue; values.object1_y = list.screencoordinates_y.nextvalue}]
/ontrialbegin = [if (values.numberofobjects >= 2) {values.object2 = list.arrayobjects.nextvalue; values.object2_x = list.screencoordinates_x.nextvalue; values.object2_y = list.screencoordinates_y.nextvalue}]
/ontrialbegin = [if (values.numberofobjects >= 3) {values.object3 = list.arrayobjects.nextvalue; values.object3_x = list.screencoordinates_x.nextvalue; values.object3_y = list.screencoordinates_y.nextvalue}]
/ontrialbegin = [if (values.numberofobjects >= 4) {values.object4 = list.arrayobjects.nextvalue; values.object4_x = list.screencoordinates_x.nextvalue; values.object4_y = list.screencoordinates_y.nextvalue}]
/ontrialbegin = [if (values.numberofobjects >= 5) {values.object5 = list.arrayobjects.nextvalue; values.object5_x = list.screencoordinates_x.nextvalue; values.object5_y = list.screencoordinates_y.nextvalue}]
/ontrialbegin = [if (values.numberofobjects >= 6) {values.object6 = list.arrayobjects.nextvalue; values.object6_x = list.screencoordinates_x.nextvalue; values.object6_y = list.screencoordinates_y.nextvalue}]
/ontrialbegin = [if (values.numberofobjects >= 7) {values.object7 = list.arrayobjects.nextvalue; values.object7_x = list.screencoordinates_x.nextvalue; values.object7_y = list.screencoordinates_y.nextvalue}]
/ontrialbegin = [if (values.numberofobjects >= 8) {values.object8 = list.arrayobjects.nextvalue; values.object8_x = list.screencoordinates_x.nextvalue; values.object8_y = list.screencoordinates_y.nextvalue}]
</trial createarray>


Any insights as to why I'm sometimes getting items assigned to the same location? I've fiddled with this for a while and keep coming up with the same outcome. I left out the parts of the script that don't have to do with location but let me know if the full script is needed.

Thanks!
By Dave - 9/18/2019

ldb24 - 9/18/2019
I'm working on a task that will show either 4, 5, or 8 colored squares on the screen. I'm having an issue though with the location assignment as occasionally I will get a trial with 3, 5, or 7 items (though I did get one 2). I figured out that on some trials items are getting assigned to the same location. 

Thing is I've been using some variant of this script for a while and never had the issue. I've modeled it after the ChangeBlindness script on the task library and I think I have everything set up the same way. The relevant bits are:

<values>
/column1_x = 45%
/column2_x = 50%
/column3_x = 55%
/column4_x = 60%
/row1_y = 45%
/row2_y = 50%
/row3_y = 55%

/object1_x = 0
/object2_x = 0
/object3_x = 0
/object4_x = 0
/object5_x = 0
/object6_x = 0
/object7_x = 0
/object8_x = 0

/object1_y = 0
/object2_y = 0
/object3_y = 0
/object4_y = 0
/object5_y = 0
/object6_y = 0
/object7_y = 0
/object8_y = 0
</values>

<picture object1>
/items = objects
/select = values.object1
/hposition = values.object1_x
/vposition = values.object1_y
/size = (20,20)
</picture>

<picture object2>
/items = objects
/select = values.object2
/hposition = values.object2_x
/vposition = values.object2_y
/size = (20,20)
</picture>

<picture object3>
/items = objects
/select = values.object3
/hposition = values.object3_x
/vposition = values.object3_y
/size = (20,20)
</picture>

<picture object4>
/items = objects
/select = values.object4
/hposition = values.object4_x
/vposition = values.object4_y
/size = (20,20)
</picture>

<picture object5>
/items = objects
/select = values.object5
/hposition = values.object5_x
/vposition = values.object5_y
/size = (20,20)
</picture>

<picture object6>
/items = objects
/select = values.object6
/hposition = values.object6_x
/vposition = values.object6_y
/size = (20,20)
</picture>

<picture object7>
/items = objects
/select = values.object7
/hposition = values.object7_x
/vposition = values.object7_y
/size = (20,20)
</picture>

<picture object8>
/items = objects
/select = values.object8
/hposition = values.object8_x
/vposition = values.object8_y
/size = (20,20)
</picture>

<list screencoordinates_x>
/items = (values.column1_x, values.column1_x, values.column1_x,
values.column2_x, values.column2_x, values.column2_x,
values.column3_x, values.column3_x, values.column3_x,
values.column4_x, values.column4_x, values.column4_x)
/replace = false
/selectionrate = always
</list>

<list screencoordinates_y>
/items = (values.row1_y, values.row2_y, values.row3_y, values.row4_y,
values.row1_y, values.row2_y, values.row3_y, values.row4_y,
values.row1_y, values.row2_y, values.row3_y, values.row4_y)
/ selectionmode= list.screencoordinates_x.currentindex
/ selectionrate = always
</list>

<trial createarray>
/ontrialbegin = [if (values.numberofobjects >= 1) {values.object1 = list.arrayobjects.nextvalue; values.object1_x = list.screencoordinates_x.nextvalue; values.object1_y = list.screencoordinates_y.nextvalue}]
/ontrialbegin = [if (values.numberofobjects >= 2) {values.object2 = list.arrayobjects.nextvalue; values.object2_x = list.screencoordinates_x.nextvalue; values.object2_y = list.screencoordinates_y.nextvalue}]
/ontrialbegin = [if (values.numberofobjects >= 3) {values.object3 = list.arrayobjects.nextvalue; values.object3_x = list.screencoordinates_x.nextvalue; values.object3_y = list.screencoordinates_y.nextvalue}]
/ontrialbegin = [if (values.numberofobjects >= 4) {values.object4 = list.arrayobjects.nextvalue; values.object4_x = list.screencoordinates_x.nextvalue; values.object4_y = list.screencoordinates_y.nextvalue}]
/ontrialbegin = [if (values.numberofobjects >= 5) {values.object5 = list.arrayobjects.nextvalue; values.object5_x = list.screencoordinates_x.nextvalue; values.object5_y = list.screencoordinates_y.nextvalue}]
/ontrialbegin = [if (values.numberofobjects >= 6) {values.object6 = list.arrayobjects.nextvalue; values.object6_x = list.screencoordinates_x.nextvalue; values.object6_y = list.screencoordinates_y.nextvalue}]
/ontrialbegin = [if (values.numberofobjects >= 7) {values.object7 = list.arrayobjects.nextvalue; values.object7_x = list.screencoordinates_x.nextvalue; values.object7_y = list.screencoordinates_y.nextvalue}]
/ontrialbegin = [if (values.numberofobjects >= 8) {values.object8 = list.arrayobjects.nextvalue; values.object8_x = list.screencoordinates_x.nextvalue; values.object8_y = list.screencoordinates_y.nextvalue}]
</trial createarray>


Any insights as to why I'm sometimes getting items assigned to the same location? I've fiddled with this for a while and keep coming up with the same outcome. I left out the parts of the script that don't have to do with location but let me know if the full script is needed.

Thanks!

You are sampling coordinates from <list> elements. Those lists are set to sample randomly without replacement. When you sample a varying number of positions (for a varying number of on-screen objects) from those lists, at some point the position lists will run out of unsampled positions in the middle of a trial -- the list then has to reset and all positions become available for sampling again, including those already sampled during the trial before the list ran out of items. This, then, will lead to overlapping positions -- i.e. multiple objects being assigned the same position in the trial. Make sure to reset your lists properly (e.g. at the beginning or end of each trial) such that they *don't* run out of positions to sample from during some subsequent trial.
By ldb24 - 9/18/2019

Dave - 9/18/2019
ldb24 - 9/18/2019
I'm working on a task that will show either 4, 5, or 8 colored squares on the screen. I'm having an issue though with the location assignment as occasionally I will get a trial with 3, 5, or 7 items (though I did get one 2). I figured out that on some trials items are getting assigned to the same location. 

Thing is I've been using some variant of this script for a while and never had the issue. I've modeled it after the ChangeBlindness script on the task library and I think I have everything set up the same way. The relevant bits are:

<values>
/column1_x = 45%
/column2_x = 50%
/column3_x = 55%
/column4_x = 60%
/row1_y = 45%
/row2_y = 50%
/row3_y = 55%

/object1_x = 0
/object2_x = 0
/object3_x = 0
/object4_x = 0
/object5_x = 0
/object6_x = 0
/object7_x = 0
/object8_x = 0

/object1_y = 0
/object2_y = 0
/object3_y = 0
/object4_y = 0
/object5_y = 0
/object6_y = 0
/object7_y = 0
/object8_y = 0
</values>

<picture object1>
/items = objects
/select = values.object1
/hposition = values.object1_x
/vposition = values.object1_y
/size = (20,20)
</picture>

<picture object2>
/items = objects
/select = values.object2
/hposition = values.object2_x
/vposition = values.object2_y
/size = (20,20)
</picture>

<picture object3>
/items = objects
/select = values.object3
/hposition = values.object3_x
/vposition = values.object3_y
/size = (20,20)
</picture>

<picture object4>
/items = objects
/select = values.object4
/hposition = values.object4_x
/vposition = values.object4_y
/size = (20,20)
</picture>

<picture object5>
/items = objects
/select = values.object5
/hposition = values.object5_x
/vposition = values.object5_y
/size = (20,20)
</picture>

<picture object6>
/items = objects
/select = values.object6
/hposition = values.object6_x
/vposition = values.object6_y
/size = (20,20)
</picture>

<picture object7>
/items = objects
/select = values.object7
/hposition = values.object7_x
/vposition = values.object7_y
/size = (20,20)
</picture>

<picture object8>
/items = objects
/select = values.object8
/hposition = values.object8_x
/vposition = values.object8_y
/size = (20,20)
</picture>

<list screencoordinates_x>
/items = (values.column1_x, values.column1_x, values.column1_x,
values.column2_x, values.column2_x, values.column2_x,
values.column3_x, values.column3_x, values.column3_x,
values.column4_x, values.column4_x, values.column4_x)
/replace = false
/selectionrate = always
</list>

<list screencoordinates_y>
/items = (values.row1_y, values.row2_y, values.row3_y, values.row4_y,
values.row1_y, values.row2_y, values.row3_y, values.row4_y,
values.row1_y, values.row2_y, values.row3_y, values.row4_y)
/ selectionmode= list.screencoordinates_x.currentindex
/ selectionrate = always
</list>

<trial createarray>
/ontrialbegin = [if (values.numberofobjects >= 1) {values.object1 = list.arrayobjects.nextvalue; values.object1_x = list.screencoordinates_x.nextvalue; values.object1_y = list.screencoordinates_y.nextvalue}]
/ontrialbegin = [if (values.numberofobjects >= 2) {values.object2 = list.arrayobjects.nextvalue; values.object2_x = list.screencoordinates_x.nextvalue; values.object2_y = list.screencoordinates_y.nextvalue}]
/ontrialbegin = [if (values.numberofobjects >= 3) {values.object3 = list.arrayobjects.nextvalue; values.object3_x = list.screencoordinates_x.nextvalue; values.object3_y = list.screencoordinates_y.nextvalue}]
/ontrialbegin = [if (values.numberofobjects >= 4) {values.object4 = list.arrayobjects.nextvalue; values.object4_x = list.screencoordinates_x.nextvalue; values.object4_y = list.screencoordinates_y.nextvalue}]
/ontrialbegin = [if (values.numberofobjects >= 5) {values.object5 = list.arrayobjects.nextvalue; values.object5_x = list.screencoordinates_x.nextvalue; values.object5_y = list.screencoordinates_y.nextvalue}]
/ontrialbegin = [if (values.numberofobjects >= 6) {values.object6 = list.arrayobjects.nextvalue; values.object6_x = list.screencoordinates_x.nextvalue; values.object6_y = list.screencoordinates_y.nextvalue}]
/ontrialbegin = [if (values.numberofobjects >= 7) {values.object7 = list.arrayobjects.nextvalue; values.object7_x = list.screencoordinates_x.nextvalue; values.object7_y = list.screencoordinates_y.nextvalue}]
/ontrialbegin = [if (values.numberofobjects >= 8) {values.object8 = list.arrayobjects.nextvalue; values.object8_x = list.screencoordinates_x.nextvalue; values.object8_y = list.screencoordinates_y.nextvalue}]
</trial createarray>


Any insights as to why I'm sometimes getting items assigned to the same location? I've fiddled with this for a while and keep coming up with the same outcome. I left out the parts of the script that don't have to do with location but let me know if the full script is needed.

Thanks!

You are sampling coordinates from <list> elements. Those lists are set to sample randomly without replacement. When you sample a varying number of positions (for a varying number of on-screen objects) from those lists, at some point the position lists will run out of unsampled positions in the middle of a trial -- the list then has to reset and all positions become available for sampling again, including those already sampled during the trial before the list ran out of items. This, then, will lead to overlapping positions -- i.e. multiple objects being assigned the same position in the trial. Make sure to reset your lists properly (e.g. at the beginning or end of each trial) such that they *don't* run out of positions to sample from during some subsequent trial.

Ah okay, that did the trick. I was resetting the x and y values for each object but NOT the list. Thank you!