Randomizing position of stimuli


Author
Message
***JayD***
***JayD***
Distinguished Member (4K reputation)Distinguished Member (4K reputation)Distinguished Member (4K reputation)Distinguished Member (4K reputation)Distinguished Member (4K reputation)Distinguished Member (4K reputation)Distinguished Member (4K reputation)Distinguished Member (4K reputation)Distinguished Member (4K reputation)
Group: Forum Members
Posts: 17, Visits: 67
Hi,

I'm attempting to write a task wherein participants are shown several coloured squares, followed by an inter-trial interval, followed by the presentation of only one of the previously shown squares (in its original position). Participants must respond with whether they think the square is the same or a different colour. 

The stimuli in the first instance should appear randomly, trial by trial. When the single stimulus is shown subsequently, it should be in the exact same position. There is a simple diagram here (http://www.scholarpedia.org/article/Visual_short_term_memory; Figure 1) of what I'm attempting to build (except in my task the "Test Array Until Response" only shows one of the previous squares - in this case, the yellow one).

I've got some code written but am already receiving error messages and I don't think the way I've set up my trials will give the desired result...

<defaults>
/ screencolor = (192, 192, 192)
/ fontstyle = ("Arial", 28pt, false,false)
/ txcolor = (0, 255, 0)
/ pretrialpause = 0
/ inputdevice = keyboard
</defaults>

*******

<text fixation>
/ items = ("+")
/ position = (50,50)
/ txcolor = (255,255,255)
/ txbgcolor = (transparent)
/ fontstyle = ("Arial", 64pt, false,false)
</text>

********

<item Red_Square>
/ 1 = "RED.bmp"
</item>

<item Blue_Square>
/ 1 = "BLUE.bmp"
</item>

ETC....

<picture Red_Square>
/ items = Red_Square
/ position = counter.Red_Square_pos.selectedvalue
</picture>

<picture Blue_Square>
/ items = Blue_Square
/ position = counter.Blue_Square_pos.selectedvalue
</picture>

ETC....

<counter Red_Square_pos>
/ items = (1%, 2%, 3%, 4%, 5%, 6%, 7%, 8%, 9%, 10%, 11%, 12%, 13%, 14%, 15%, 16%, 17%, 18%, 19%, 20%, 21%, 22%, 23%, 24%, 25%, 26%, 27%, 28%, 29%, 30%, 31%, 32%, 33%, 34%, 35%, 36%, 37%, 38%, 39%, 61%, 62%, 63%, 64%, 65%, 66%, 67%, 68%, 69%, 70%, 71%, 72%, 73%, 74%, 75%, 76%, 77%, 78%, 79%, 80%, 81%, 82%, 83%, 84%, 85%, 86%, 87%, 88%, 89%, 90%, 91%, 92%, 93%, 94%, 95%, 96%, 97%, 98%, 99%, 100%)
/ not = (Blue_Square_pos, Green_Square_pos, Yellow_Square_pos, Black_Square_pos, Brown_Square_pos, Orange_Square_pos, Purple_Square_pos)
/ select = noreplace
/ selectionrate = always
</counter>

<counter Blue_Square_pos>
/ items = (1%, 2%, 3%, 4%, 5%, 6%, 7%, 8%, 9%, 10%, 11%, 12%, 13%, 14%, 15%, 16%, 17%, 18%, 19%, 20%, 21%, 22%, 23%, 24%, 25%, 26%, 27%, 28%, 29%, 30%, 31%, 32%, 33%, 34%, 35%, 36%, 37%, 38%, 39%, 61%, 62%, 63%, 64%, 65%, 66%, 67%, 68%, 69%, 70%, 71%, 72%, 73%, 74%, 75%, 76%, 77%, 78%, 79%, 80%, 81%, 82%, 83%, 84%, 85%, 86%, 87%, 88%, 89%, 90%, 91%, 92%, 93%, 94%, 95%, 96%, 97%, 98%, 99%, 100%)
/ not = (Red_Square_pos, Green_Square_pos, Yellow_Square_pos, Black_Square_pos, Brown_Square_pos, Orange_Square_pos, Purple_Square_pos)
/ select = noreplace
/ selectionrate = always
</counter>

***************** NOTE THAT I'VE REMOVED 40%-60% AS I DON'T WANT THE STIMULI AROUND THE CENTRE OF THE SCREEN 

<trial Red_4_Same>
/ stimulustimes = [1 = fixation; 500 = Red_Square, Blue_Square; 600 = ; 1500 = Red_Square]
/ inputdevice = keyboard
/ correctresponse = ("z")
/ validresponse = ("m", "z")
/ trialduration = 2500
/ responsetime = 1500
/ responseinterrupt = immediate
</trial>

*******************

I'm not sure whether - because of the counter - the second presentation of the 'Red_Square' will be randomized... I'm also unable to check as I keep getting error messages for the picture elements: 

<picture Red_Square>
/position: Missing '('.

Any help is greatly appreciated!

Thanks,

Jay
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: 12K, Visits: 98K
> I'm not sure whether - because of the counter - the second presentation of the 'Red_Square' will be randomized..

No, it wont be because once the trial is running, the <picture> element cannot change position. It's not clear to me, however, why you set your <counter>s to / selectionrate = always. It seems to me you only want a single selection from the counter per trial, and thus / selectionrate = trial. Beyond that, I don't actually think you need separate <counter>s per square. Depending on how want to randomize the various stimuli's x and y positions, you should need at most than two counters (one for x, one for y).

> I'm also unable to check as I keep getting error messages for the picture elements: 
>
> <picture Red_Square>
> /position: Missing '('.

/ position = counter.Red_Square_pos.selectedvalue

Position is defined by *two* coordinates, horizontal and vertical, in parenthesis (), separated by a comma: You do not provide that, hence the error.

To sum up, if I were you, I'd go for something like this:

<values>
/ redx = 0%
/ redy = 0%
/ bluex = 0%
/ bluey = 0%
</values>

<block someblock>
/ trials = [1-2 = red_same]
</block>

<trial red_same>
/ ontrialbegin = [reset(counter.randpos); ]
/ ontrialbegin = [values.redx=counter.randpos.selectedvalue; values.redy=counter.randpos.selectedvalue;
    values.bluex=counter.randpos.selectedvalue; values.bluey=counter.randpos.selectedvalue;]
/ stimulustimes = [1 = fixation; 500 = Red_Square, Blue_Square; 600 = blank; 1500 = Red_Square]
/ validresponse = ("s", "d")
/ correctresponse = ("d")
</trial>

<shape red_square>
/ color = red
/ shape = rectangle
/ size = (100px, 100px)
/ hposition = values.redx
/ vposition = values.redy
</shape>

<shape blue_square>
/ color = blue
/ shape = rectangle
/ size = (100px, 100px)
/ hposition = values.bluex
/ vposition = values.bluey
</shape>

<counter randpos>
/ items = (1%, 2%, 3%, 4%, 5%, 6%, 7%, 8%, 9%, 10%,
    11%, 12%, 13%, 14%, 15%, 16%, 17%, 18%, 19%, 20%,
    21%, 22%, 23%, 24%, 25%, 26%, 27%, 28%, 29%, 30%,
    31%, 32%, 33%, 34%, 35%, 36%, 37%, 38%, 39%,
    61%, 62%, 63%, 64%, 65%, 66%, 67%, 68%, 69%, 70%,
    71%, 72%, 73%, 74%, 75%, 76%, 77%, 78%, 79%, 80%,
    81%, 82%, 83%, 84%, 85%, 86%, 87%, 88%, 89%, 90%,
    91%, 92%, 93%, 94%, 95%, 96%, 97%, 98%, 99%, 100%)
/ select = noreplace
/ selectionrate = always
</counter>

<text fixation>
/ items = ("+")
</text>

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


***JayD***
***JayD***
Distinguished Member (4K reputation)Distinguished Member (4K reputation)Distinguished Member (4K reputation)Distinguished Member (4K reputation)Distinguished Member (4K reputation)Distinguished Member (4K reputation)Distinguished Member (4K reputation)Distinguished Member (4K reputation)Distinguished Member (4K reputation)
Group: Forum Members
Posts: 17, Visits: 67
Hi Dave,

Thanks a lot for your reply, it was really helpful. I just have two more questions regarding the script:

1) Am I able to create trials in which the subsequent presentation of the single square (presented in the "Test Array Until Response" portion) is no longer the same colour, but is still in the same position? 

The trial you lay out gives: presentation of red & blue > blank > red OR blue (in same position AND same colour).

However, I'm not sure how best to create: presentation of red & blue > blank > green (in same position as red, for example).

2) Is there a way to ensure that the squares do not overlap, without creating a specific counter for each square (I've created separate one [see below] but it doesn't seem to work)?

<counter randpos_red>
/ items = (11%, 12%, 13%, 14%, 15%, 16%, 17%, 18%, 19%, 20%,
  21%, 22%, 23%, 24%, 25%, 26%, 27%, 28%, 29%, 30%,
  31%, 32%, 33%, 34%, 35%, 36%, 37%, 38%, 39%,
  61%, 62%, 63%, 64%, 65%, 66%, 67%, 68%, 69%, 70%,
  71%, 72%, 73%, 74%, 75%, 76%, 77%, 78%, 79%, 80%,
  81%, 82%, 83%, 84%, 85%, 86%, 87%, 88%, 89%, 90%)
/ select = noreplace
/ not = (randpos_blue, randpos_green)
/ selectionrate = always
</counter>

<counter randpos_blue>
/ items = (11%, 12%, 13%, 14%, 15%, 16%, 17%, 18%, 19%, 20%,
  21%, 22%, 23%, 24%, 25%, 26%, 27%, 28%, 29%, 30%,
  31%, 32%, 33%, 34%, 35%, 36%, 37%, 38%, 39%,
  61%, 62%, 63%, 64%, 65%, 66%, 67%, 68%, 69%, 70%,
  71%, 72%, 73%, 74%, 75%, 76%, 77%, 78%, 79%, 80%,
  81%, 82%, 83%, 84%, 85%, 86%, 87%, 88%, 89%, 90%)
/ select = noreplace
/ not = (randpos_red, randpos_green)
/ selectionrate = always
</counter>

<counter randpos_green>
/ items = (11%, 12%, 13%, 14%, 15%, 16%, 17%, 18%, 19%, 20%,
  21%, 22%, 23%, 24%, 25%, 26%, 27%, 28%, 29%, 30%,
  31%, 32%, 33%, 34%, 35%, 36%, 37%, 38%, 39%,
  61%, 62%, 63%, 64%, 65%, 66%, 67%, 68%, 69%, 70%,
  71%, 72%, 73%, 74%, 75%, 76%, 77%, 78%, 79%, 80%,
  81%, 82%, 83%, 84%, 85%, 86%, 87%, 88%, 89%, 90%)
/ select = noreplace
/ not = (randpos_blue, randpos_red)
/ selectionrate = always
</counter>

Thanks again,

Jay
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: 12K, Visits: 98K
> 1) Am I able to create trials in which the subsequent presentation of the single square (presented in the "Test Array Until Response"
> portion) is no longer the same colour, but is still in the same position?

Yes, of course. Set the position of the differently colored square to the desired position (e.g. the one matching the red square) /ontrialbegin.

> 2) Is there a way to ensure that the squares do not overlap, without creating a specific counter for each square (I've created separate one
> [see below] but it doesn't seem to work)?

As I've said in my previous response, I do not see why you even need a "specific counter for each square". You should need at most two counters. One for the x positions, one for the corresponding y positions. Then just sample all the positions from those counters, just like the example in my previous reply does (albeit it uses only a single <counter> for both x and y).

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: 12K, Visits: 98K
Example to illustrate the above:

<values>
/ redx = 0%
/ redy = 0%
/ bluex = 0%
/ bluey = 0%
/ greenx = 0%
/ greeny = 0%
</values>

<block someblock>
/ trials = [1-2 = noreplace(red_same, green_same_as_red)]
</block>

<trial red_same>
/ ontrialbegin = [reset(counter.randx); reset(counter.randy);]
/ ontrialbegin = [values.redx=counter.randx.selectedvalue; values.redy=counter.randy.selectedvalue;
    values.bluex=counter.randx.selectedvalue; values.bluey=counter.randy.selectedvalue;]
/ stimulustimes = [1 = fixation; 500 = Red_Square, Blue_Square; 600 = blank; 1500 = Red_Square]
/ validresponse = ("s", "d")
/ correctresponse = ("d")
</trial>

<trial green_same_as_red>
/ ontrialbegin = [reset(counter.randx); reset(counter.randy);]
/ ontrialbegin = [values.redx=counter.randx.selectedvalue; values.redy=counter.randy.selectedvalue;
    values.bluex=counter.randx.selectedvalue; values.bluey=counter.randy.selectedvalue;]
/ ontrialbegin = [values.greenx = values.redx; values.greeny = values.redy;]
/ stimulustimes = [1 = fixation; 500 = Red_Square, Blue_Square; 600 = blank; 1500 = Green_Square]
/ validresponse = ("s", "d")
/ correctresponse = ("d")
</trial>

<shape red_square>
/ color = red
/ shape = rectangle
/ size = (100px, 100px)
/ hposition = values.redx
/ vposition = values.redy
</shape>

<shape blue_square>
/ color = blue
/ shape = rectangle
/ size = (100px, 100px)
/ hposition = values.bluex
/ vposition = values.bluey
</shape>

<shape green_square>
/ color = green
/ shape = rectangle
/ size = (100px, 100px)
/ hposition = values.greenx
/ vposition = values.greeny
</shape>

<counter randx>
/ items = (20%, 40%, 60%, 80%,
    20%, 40%, 60%, 80%,
    20%, 40%, 60%, 80%)
/ select = noreplace
/ selectionrate = always
</counter>

<counter randy>
/ items = (25%, 25%, 25%, 25%,
    50%, 50%, 50%, 50%,
    75%, 75%, 75%, 75%)
/ select = current(randx)
/ selectionrate = always
</counter>

<text fixation>
/ items = ("+")
</text>

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

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search