By nanu1002 - 2/3/2015
Hello, I have been trying to figure this out, but need your help. So I have 2 sets of 24 images ,48 iterations and no duplicates are allowed. This was working fine, till I had to also tried to include the itemnumber and picture name information as in code below (if/else condition). I am trying to figure out how to get a current image variable to store all the information and not cause an increase in the index to the items list ( causing duplicates I believe). See current image code in the second part.
Original code:
<item refnegpicslab> /1 = "images_neg/spl/reframe/214.jpg" ...24 items here </item>
<item reactnegpicslab> ...24 items here </item>
<picture refneglab> /items = refnegpicslab /select = noreplacenorepeat /position = (50%, 50%) /resetinterval = 5 </picture>
<picture reactneglab> /items = reactnegpicslab /select = noreplacenorepeat /position = (50%, 50%) /resetinterval = 5 </picture>
<trial picnegative> /pretrialpause = 16.6666666667 * 3 /ontrialbegin = [values.trialcurrenttime = script.currenttime; ] /ontrialbegin = [ if (values.currentinstrtype == "REFRAME-NEGATIVE") {trial.picnegative.insertstimulusframe(shape.rectangle_blue,1); trial.picnegative.insertstimulusframe(picture.refneglab,2); values.stimulusitem = picture.refneglab.currentitem ; values.stimulusnumber = picture.refneglab.currentitemnumber;}] /ontrialbegin = [ if (values.currentinstrtype == "REACT-NEGATIVE") {trial.picnegative.insertstimulusframe(shape.rectangle_green,1); trial.picnegative.insertstimulusframe(picture.reactneglab,2); values.stimulusitem = picture.reactneglab.currentitem ; values.stimulusnumber = picture.reactneglab.currentitemnumber;}] /timeout = 10000 + (16.6666666667 * 3 ) /showmousecursor = false </trial>
Current Image Code: ------------------------------
Tried storing picture in a current image ( http://www.millisecond.com/forums/Topic3960.aspx#3960. ) but not sure how to go about this one in the "if/else" condition. The image now doesn't index to the next and I am not sure how.
<trial picnegative> /pretrialpause = 16.6666666667 * 3 /stimulusframes = [2=PIC_canvas;3=PPTmark;10=trigger_0] /ontrialbegin = [values.trialcurrenttime = script.currenttime; ] /ontrialbegin = [ if (values.currentinstrtype == "REFRAME-NEGATIVE") {trial.picnegative.insertstimulusframe(shape.rectangle_blue,1); item.ITEM_canvas.item= picture.refneglab.currentitem; }] /ontrialbegin = [ if (values.currentinstrtype == "REACT-NEGATIVE") {trial.picnegative.insertstimulusframe(shape.rectangle_green,1); item.ITEM_canvas.item= picture.reactneglab.currentitem; }] /timeout = 500 + (16.6666666667 * 3 ) /ontrialend = [values.trialelapsedtime = trial.picnegative.elapsedtime; values.scriptelaspedtime = script.elapsedtime] /showmousecursor = false /ontrialend = [ values.response=0; ] /ontrialend = [ values.stimulusitem = picture.PIC_canvas.currentitem; values.stimulusnumber = picture.PIC_canvas.currentitemnumber;]
</trial>
<item ITEM_canvas> </item>
<picture PIC_canvas> / items = ITEM_canvas / position = (50%, 50%) </picture>
----------------------------------
My main problem is that asking for currentitemnumber, currentitem increases the index count in the 24 items set (?) and is causing duplicate images to show up in my trials.
|
By Dave - 2/3/2015
> My main problem is that asking for currentitemnumber, currentitem increases the index count in the 24 items set [...]
No, what makes you think that it does? Reading the currentitem or currentitemnumber property *does not* cause any selection or increase some index count. It passively returns the current state of the respective stimulus element.
One problem you have in your code is that you query currentitem / currentitemnumber /ontrialbegin. That's *before* any selection for the respective <picture> element has even occurred in the given trial instance. Selection won't happen until the stimulus is prepared for display, which happens *after* any /ontrialbegin logic. If you want your values to reflect what actually happened in the trial, you should move those statements to /ontrialend.
To illustrate the difference, run
<values> / currentitem_ontrialbegin = "" / currentitem_ontrialend = "" </values>
<text mytext> / items = ("A", "B", "C", "D") </text>
<trial mytrial> / ontrialbegin = [trial.mytrial.insertstimulusframe(text.mytext,1); values.currentitem_ontrialbegin=text.mytext.currentitem ;] / ontrialend = [values.currentitem_ontrialend=text.mytext.currentitem] / validresponse = (57) </trial>
<block myblock> / trials = [1-4=mytrial] </block>
<data> / columns = [trialnum trialcode stimulusitem values.currentitem_ontrialbegin values.currentitem_ontrialend] / separatefiles = true </data>
and examine the data file.
You should also consider whether you have to call resetstimulusframes() /ontrialend. It's impossible to judge from just the code snippets whether that is necessary or not. In this regard, it is important to realize that any stimulus you add to the trial's stimulus presentation sequence via insertstimulusframe() etc. will persist across all instances of the trial if you don't do a reset.
Again, to illustrate compare
<text a> / items = ("A1", "A2") / position = (50%, 48%) </text>
<text b> / items = ("B1", "B2") / position = (50%, 52%) </text>
<list mylist> / items = ("a", "a", "b", "b") </list>
<trial mytrial> / ontrialbegin = [if(list.mylist.nextvalue=="a") trial.mytrial.insertstimulusframe(text.a,1);] / ontrialbegin = [if(list.mylist.nextvalue=="b") trial.mytrial.insertstimulusframe(text.b,1);] / validresponse = (57) </trial>
<block myblock> / trials = [1-4=mytrial] </block>
<data> / columns = [trialnum trialcode stimulusitem stimulusitem] / separatefiles = true </data>
against
<text a> / items = ("A1", "A2") / position = (50%, 48%) </text>
<text b> / items = ("B1", "B2") / position = (50%, 52%) </text>
<list mylist> / items = ("a", "a", "b", "b") </list>
<trial mytrial> / ontrialbegin = [if(list.mylist.nextvalue=="a") trial.mytrial.insertstimulusframe(text.a,1);] / ontrialbegin = [if(list.mylist.nextvalue=="b") trial.mytrial.insertstimulusframe(text.b,1);] / validresponse = (57) / ontrialend = [trial.mytrial.resetstimulusframes();] </trial>
<block myblock> / trials = [1-4=mytrial] </block>
<data> / columns = [trialnum trialcode stimulusitem stimulusitem] / separatefiles = true </data>
|
By nanu1002 - 2/4/2015
Thanks for that clarification. It makes sense now.
|
|