Millisecond Forums

random stimulus presentation times

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

By jens - 11/17/2013

Hello,


I am writing an Inquisit-script for a EEG-experiment. One requirement is to jitter the presentation times of various stimuli, e.g. the time interval of the fixation cross, the blank screen and the stimulus. Inquisit offers function to random number generation, e.g. rand(40,43). However a definition such as the following does not work


<trial mg1>
/stimulusframes = [10 = fixation.pic; 25 = maske; ipart(rand(40,43) = mg1.pic]
/validresponse = ("F", "J")
/correctresponse = ("J")
/pretrialpause = rand(400,600)
</trial>


Using an expression or defining the onset-variable as a counter or value did not work. At least, I did not get to run. Any suggestions?


Jens


By Dave - 11/17/2013

It isn't supposed to work like that. To do this, you need to make use of some of the <trial> element's member functions via /ontrialbegin. You'll want to see the language reference for setstimulustime(), insertstimulustime() and resetstimulusframes().


Edited to add:


[1] There are, of course, corresponding frame-based functions: setstimulusframe(), insertstimulusframe(), etc.


[2] Here's a re-posting of a self-contained illustrative example (http://www.millisecond.com/forums/Topic11148.aspx#11148):


<list fixationduration>
/ items = (500, 5000, 10000)
</list>

<trial mytrial>
/ ontrialbegin = [trial.mytrial.setstimulustime(text.a, list.fixationduration.nextvalue);
    trial.mytrial.insertstimulustime(text.b, list.fixationduration.nextvalue)]
/ ontrialend = [trial.mytrial.resetstimulusframes()]
/ stimulustimes = [0=fixation]
/ validresponse = (57)
</trial>

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

<text a>
/ items = ("A")
/ position = (45%, 50%)
</text>

<text b>
/ items = ("B")
/ position = (55%, 50%)
</text>

<block myblock>
/ trials = [1-3=mytrial]
</block>

By jens - 11/17/2013

Hello,


thanks a lot for pointing me to the proper functions. The example you provided worked nicely. I, however, get the message that the message "Failed to call the function 'setstimulusframe' on element 'trial.mg1'." When changing everything to stimulustimes, I get the comparable error message. I attached the script, perhaps this helps (BTW, the file filter of the upload function rejects iqx-files).


Best wishes Jens



By Dave - 11/17/2013

Just like in my example, you need to provide proper syntax including element type:


<trial mg1>
/ontrialbegin = [trial.mg1.setstimulusframe(mg1.pic, list.onset.nextvalue); ...]
[...]
</trial>


ought to be


<trial mg1>
/ontrialbegin = [trial.mg1.setstimulusframe(picture.mg1.pic, list.onset.nextvalue); ...]
[...]
</trial>

By jens - 11/18/2013

Hello Dave,


as in your example, proper syntax helps. [:)]


Best Jens

By jens - 11/24/2013

Hello,



is there a way to store/display the filename of the inserted picture in the data file?


Best wishes Jens

By Dave - 11/24/2013

Usually


<data>
/ columns = [..., picture.mg1.pic.currentitem, ...]
[...]
</data>

By jens - 11/25/2013

Hello,


good idea. I altered it a little bit by assigning the filename to a value on trialend (e.g., /ontrialend = [trial.fg2.resetstimulusframes();values.file = picture.fg2.pic.currentitem]) and then reporting values.file as a column in the data-element.


Best regards Jens