By Julian_Bas - 3/10/2020
Dear forum
I have a question regarding some difficulty I'm experiencing in trying to dynamically insert two stimuli into a trial using the trial.setstimulustime() or trial.insertstimulustime() commands. From reading the documentation on each of these commands, I also am not clear on the difference between each. Any help here would be very much appreciated :) My apologies if this information is present elsewhere. I could not locate an answer on the forums or the Inquisit help information.
In each trial i wish to present a black square and a white square simultaneously. However, the onset time of these stimuli varies randomly at either 500ms or 1000ms from the start of the trial. I randomly select this onset time (SOA) by importing items from a list into a value at the start of each trial, then checking the contents of the value to determine the appropriate stimulustime.
At present, my code is similar to the example code below
<list SOAselection> / items = (500, 1000) / selectionmode = random </list>
<trial mytrial> / ontrialbegin = [values.SOA = list.SOAselection.nextvalue] / ontrialbegin = [if(values.SOA == 500) trial.mytrial.setstimulustime(picture.blacksquare, 500)] / ontrialbegin = [if(values.SOA == 500) trial.mytrial.setstimulustime(picture.whitesquare, 500)] / ontrialbegin = [if(values.SOA == 1000) trial.mytrial.setstimulustime(picture.blacksquare, 1000)] / ontrialbegin = [if(values.SOA == 1000) trial.mytrial.setstimulustime(picturewhitesquare, 1000)] / stimulustimes = [0 = outline] ..... / ontrialend = [trial.mytrial.resetstimulusframes()] </trial>
However, using this code only 1 of the stimuli are presented. In this case, the white square. Interestingly, when I swap the order of the black square and white square in the if statement, then the black square is presented only. This leads me to believe that the second setting of setstimulustime is 'overwriting the first.
Thus, my primary question is twofold: 1) Is it possible to use setstimulustime or insertstimulustime to vary the onset of more than one stimulus? 2) If so, how may this be achieved?
A supplementary question is an explanation on the precise difference between setstimulustime and insertstimulustime
I would be very grateful for any insight into these queries. Thank you very much! :)
|
By Dave - 3/11/2020
+xDear forum I have a question regarding some difficulty I'm experiencing in trying to dynamically insert two stimuli into a trial using the trial.setstimulustime() or trial.insertstimulustime() commands. From reading the documentation on each of these commands, I also am not clear on the difference between each. Any help here would be very much appreciated :) My apologies if this information is present elsewhere. I could not locate an answer on the forums or the Inquisit help information. In each trial i wish to present a black square and a white square simultaneously. However, the onset time of these stimuli varies randomly at either 500ms or 1000ms from the start of the trial. I randomly select this onset time (SOA) by importing items from a list into a value at the start of each trial, then checking the contents of the value to determine the appropriate stimulustime. At present, my code is similar to the example code below <list SOAselection> / items = (500, 1000) / selectionmode = random </list> <trial mytrial> / ontrialbegin = [values.SOA = list.SOAselection.nextvalue] / ontrialbegin = [if(values.SOA == 500) trial.mytrial.setstimulustime(picture.blacksquare, 500)] / ontrialbegin = [if(values.SOA == 500) trial.mytrial.setstimulustime(picture.whitesquare, 500)] / ontrialbegin = [if(values.SOA == 1000) trial.mytrial.setstimulustime(picture.blacksquare, 1000)] / ontrialbegin = [if(values.SOA == 1000) trial.mytrial.setstimulustime(picturewhitesquare, 1000)] / stimulustimes = [0 = outline] ..... / ontrialend = [trial.mytrial.resetstimulusframes()] </trial> However, using this code only 1 of the stimuli are presented. In this case, the white square. Interestingly, when I swap the order of the black square and white square in the if statement, then the black square is presented only. This leads me to believe that the second setting of setstimulustime is 'overwriting the first. Thus, my primary question is twofold: 1) Is it possible to use setstimulustime or insertstimulustime to vary the onset of more than one stimulus? 2) If so, how may this be achieved? A supplementary question is an explanation on the precise difference between setstimulustime and insertstimulustime I would be very grateful for any insight into these queries. Thank you very much! :) setstimulustime() sets the given frame in the trial to the given stimulus, i.e. it will replace anything that may have been scheduled for that frame before. insertstimulustime() is additive, i.e. stimuli are added to the given frame in the order given.
Typically, you can just use insertstimulustime() throughout as in
<values> / soa = 0 </values>
<list soaselection> / items = (500, 1000) / replace = true </list>
<trial mytrial> / ontrialbegin = [values.SOA = list.SOAselection.nextvalue] / ontrialbegin = [if(values.SOA == 500) trial.mytrial.insertstimulustime(shape.blacksquare, 500)] / ontrialbegin = [if(values.SOA == 500) trial.mytrial.insertstimulustime(shape.whitesquare, 500)] / ontrialbegin = [if(values.SOA == 1000) trial.mytrial.insertstimulustime(shape.blacksquare, 1000)] / ontrialbegin = [if(values.SOA == 1000) trial.mytrial.insertstimulustime(shape.whitesquare, 1000)] / stimulustimes = [0 = outline] / validresponse = (57) / ontrialend = [trial.mytrial.resetstimulusframes()] </trial>
<shape outline> / shape = rectangle / color = gray / size = (80%, 80%) </shape>
<shape blacksquare> / shape = rectangle / color = black / size = (400px, 400px) / position = (30%, 50%) </shape>
<shape whitesquare> / shape = rectangle / color = white / size = (400px, 400px) / position = (70%, 50%) </shape>
As a side note, you can get rid of the conditionals and simplify the code to
<values> / soa = 0 </values>
<list soaselection> / items = (500, 1000) / replace = true </list>
<trial mytrial> / ontrialbegin = [values.SOA = list.SOAselection.nextvalue; trial.mytrial.insertstimulustime(shape.blacksquare, values.soa); trial.mytrial.insertstimulustime(shape.whitesquare, values.soa); ] / stimulustimes = [0 = outline] / validresponse = (57) / ontrialend = [trial.mytrial.resetstimulusframes()] </trial>
<shape outline> / shape = rectangle / color = gray / size = (80%, 80%) </shape>
<shape blacksquare> / shape = rectangle / color = black / size = (400px, 400px) / position = (30%, 50%) </shape>
<shape whitesquare> / shape = rectangle / color = white / size = (400px, 400px) / position = (70%, 50%) </shape>
|
By Julian_Bas - 3/11/2020
+x+xDear forum I have a question regarding some difficulty I'm experiencing in trying to dynamically insert two stimuli into a trial using the trial.setstimulustime() or trial.insertstimulustime() commands. From reading the documentation on each of these commands, I also am not clear on the difference between each. Any help here would be very much appreciated :) My apologies if this information is present elsewhere. I could not locate an answer on the forums or the Inquisit help information. In each trial i wish to present a black square and a white square simultaneously. However, the onset time of these stimuli varies randomly at either 500ms or 1000ms from the start of the trial. I randomly select this onset time (SOA) by importing items from a list into a value at the start of each trial, then checking the contents of the value to determine the appropriate stimulustime. At present, my code is similar to the example code below <list SOAselection> / items = (500, 1000) / selectionmode = random </list> <trial mytrial> / ontrialbegin = [values.SOA = list.SOAselection.nextvalue] / ontrialbegin = [if(values.SOA == 500) trial.mytrial.setstimulustime(picture.blacksquare, 500)] / ontrialbegin = [if(values.SOA == 500) trial.mytrial.setstimulustime(picture.whitesquare, 500)] / ontrialbegin = [if(values.SOA == 1000) trial.mytrial.setstimulustime(picture.blacksquare, 1000)] / ontrialbegin = [if(values.SOA == 1000) trial.mytrial.setstimulustime(picturewhitesquare, 1000)] / stimulustimes = [0 = outline] ..... / ontrialend = [trial.mytrial.resetstimulusframes()] </trial> However, using this code only 1 of the stimuli are presented. In this case, the white square. Interestingly, when I swap the order of the black square and white square in the if statement, then the black square is presented only. This leads me to believe that the second setting of setstimulustime is 'overwriting the first. Thus, my primary question is twofold: 1) Is it possible to use setstimulustime or insertstimulustime to vary the onset of more than one stimulus? 2) If so, how may this be achieved? A supplementary question is an explanation on the precise difference between setstimulustime and insertstimulustime I would be very grateful for any insight into these queries. Thank you very much! :) setstimulustime() sets the given frame in the trial to the given stimulus, i.e. it will replace anything that may have been scheduled for that frame before. insertstimulustime() is additive, i.e. stimuli are added to the given frame in the order given. Typically, you can just use insertstimulustime() throughout as in <values> / soa = 0 </values> <list soaselection> / items = (500, 1000) / replace = true </list> <trial mytrial> / ontrialbegin = [values.SOA = list.SOAselection.nextvalue] / ontrialbegin = [if(values.SOA == 500) trial.mytrial.insertstimulustime(shape.blacksquare, 500)] / ontrialbegin = [if(values.SOA == 500) trial.mytrial.insertstimulustime(shape.whitesquare, 500)] / ontrialbegin = [if(values.SOA == 1000) trial.mytrial.insertstimulustime(shape.blacksquare, 1000)] / ontrialbegin = [if(values.SOA == 1000) trial.mytrial.insertstimulustime(shape.whitesquare, 1000)] / stimulustimes = [0 = outline] / validresponse = (57) / ontrialend = [trial.mytrial.resetstimulusframes()] </trial> <shape outline> / shape = rectangle / color = gray / size = (80%, 80%) </shape> <shape blacksquare> / shape = rectangle / color = black / size = (400px, 400px) / position = (30%, 50%) </shape> <shape whitesquare> / shape = rectangle / color = white / size = (400px, 400px) / position = (70%, 50%) </shape> As a side note, you can get rid of the conditionals and simplify the code to <values> / soa = 0 </values> <list soaselection> / items = (500, 1000) / replace = true </list> <trial mytrial> / ontrialbegin = [values.SOA = list.SOAselection.nextvalue; trial.mytrial.insertstimulustime(shape.blacksquare, values.soa); trial.mytrial.insertstimulustime(shape.whitesquare, values.soa); ] / stimulustimes = [0 = outline] / validresponse = (57) / ontrialend = [trial.mytrial.resetstimulusframes()] </trial> <shape outline> / shape = rectangle / color = gray / size = (80%, 80%) </shape> <shape blacksquare> / shape = rectangle / color = black / size = (400px, 400px) / position = (30%, 50%) </shape> <shape whitesquare> / shape = rectangle / color = white / size = (400px, 400px) / position = (70%, 50%) </shape> Hello Dave! :)
Thanks once more for a prompt reply!
This is very useful to know. I didn't realise the difference between the setstimulustime() and insertstimulustime() as this information is not presented in the documentation.
I ran your code in isolation and I am achieving the desired outcome. Thank you for providing this example. I'll adopt this approach in my own code in the hope that it will also achieve the desired outcome.
Thanks very much once again Dave! :)
Best regards,
|
|