Stimuli selection from item pool not working


Author
Message
pops
pops
Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)
Group: Forum Members
Posts: 69, Visits: 85
Inquisit is not behaving as I would expect but I have no idea why:
I have three stimulus pools coded as items that have my jpg files in them.

<item angryPics>
/ 1 ="004_o_m_a_a.jpg"
/ 2 ="004_o_m_a_b.jpg"
/ 3 ="066_y_m_a_a.jpg"
/ 4 ="066_y_m_a_b.jpg"
/ 5 ="079_o_f_a_a.jpg"
/ 6 ="079_o_f_a_b.jpg"
/ 7 ="140_y_f_a_a.jpg"
/ 8 ="140_y_f_a_b.jpg"
</item>

<item fearPics>
/ 1 ="004_o_m_f_a.jpg"
/ 2 ="004_o_m_f_b.jpg"
/ 3 ="066_y_m_f_a.jpg"
/ 4 ="066_y_m_f_b.jpg"
/ 5 ="079_o_f_f_a.jpg"
/ 6 ="079_o_f_f_b.jpg"
/ 7 ="140_y_f_f_a.jpg"
/ 8 ="140_y_f_f_b.jpg"
</item>

<item neutralPics>
/ 1 ="004_o_m_n_a.jpg"
/ 2 ="004_o_m_n_b.jpg"
/ 3 ="066_y_m_n_a.jpg"
/ 4 ="066_y_m_n_b.jpg"
/ 5 ="079_o_f_n_a.jpg"
/ 6 ="079_o_f_n_b.jpg"
/ 7 ="140_y_f_n_a.jpg"
/ 8 ="140_y_f_n_b.jpg"
</item>

I then have three pictures where these items are inserted using 'noreplace'

<picture CentralAngryPic>
/ items = angryPics
/ select =noreplace
/ size = (parameters.imageheight, parameters.imageheight)
</picture>

<picture CentralNeutralPic>
/ items = neutralPics
/ select =noreplace
/ size = (parameters.imageheight, parameters.imageheight)
</picture>

<picture CentralFearPic>
/ items = fearPics
/ select =noreplace
/ size = (parameters.imageheight, parameters.imageheight)
</picture>

I determine the trial type using a list:

<list trialselectionfaceType>
/items = (1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3)
/replace = false
/selectionmode=random
</list>

Then during the trial I insert the required pic.

<trial trialfaceCentralDistractor>
/ ontrialbegin = [
    values.trialType = list.trialselectionfaceType.nextvalue;
    if (values.trialType == 1){
    trial.trialfaceCentralDistractor.insertstimulustime(picture.CentralAngryPic, values.fixationduration + parameters.blankduration);
    values.currentPic = picture.CentralAngryPic.currentitem}
    else if (values.trialType == 2){
        trial.trialfaceCentralDistractor.insertstimulustime(picture.CentralFearPic, values.fixationduration + parameters.blankduration);
        values.currentPic = picture.CentralFearPic.currentitem}
    else if (values.trialType == 3){
        trial.trialfaceCentralDistractor.insertstimulustime(picture.CentralNeutralPic, values.fixationduration + parameters.blankduration);
        values.currentPic = picture.CentralNeutralPic.currentitem}
/ validresponse = (parameters.responsekey_Targethorizontal, parameters.responsekey_Targetvertical)
/ correctresponse = (values.correctResponse)
/ beginresponsetime = values.fixationduration + parameters.blankduration;
/ timeout = 2000 + values.fixationduration + parameters.blankduration;
/ ontrialend = [
trial.trialfaceCentralDistractor.resetstimulusframes();
</trial>

<block faceBlocksReward>
/trials = [1-48 = trialfaceCentralDistractor]
</block>

I am expecting each image to be shown exactly twice in each block. Each time the picture is called I expect it to insert one of the 8 pictures into the trial and then once the pool is empty, cycle through them again. But that is not what is happening. Even though I am getting 16 trials of each of the three conditions in each block, some pics are shown more than others.
What am I doing wrong??
Thank you for any advice


pops
pops
Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)
Group: Forum Members
Posts: 69, Visits: 85
Update: After some testing it seems that the 'values.currentPic = picture.CentralXXXPic.currentitem' part of the code is not recording the correct file name :(
Not sure how I can record the current picture accurately?
Thank you

pops
pops
Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)
Group: Forum Members
Posts: 69, Visits: 85
Okay so after some digging I realise that I I need to move the offending statements to the /ontrialend rather than /ontrialbegin

/ ontrialend = [
if (values.trialType == 1){
    values.currentPic = picture.CentralAngryPic.currentitem;}
else if (values.trialType == 2){
    values.currentPic = picture.CentralFearPic.currentitem;}
else if (values.trialType == 3){
    values.currentPic = picture.CentralNeutralPic.currentitem;}

I feel as if in other scripts I have had it working using /ontrialbegin? Maybe using two consecutive /ontrialbegin statements? In any case it seems to be working now.
Thanks for listening
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
pops - 6/14/2022
Okay so after some digging I realise that I I need to move the offending statements to the /ontrialend rather than /ontrialbegin

/ ontrialend = [
if (values.trialType == 1){
    values.currentPic = picture.CentralAngryPic.currentitem;}
else if (values.trialType == 2){
    values.currentPic = picture.CentralFearPic.currentitem;}
else if (values.trialType == 3){
    values.currentPic = picture.CentralNeutralPic.currentitem;}

I feel as if in other scripts I have had it working using /ontrialbegin? Maybe using two consecutive /ontrialbegin statements? In any case it seems to be working now.
Thanks for listening

In your trials, the item selection for the picture elements only happens once the stimulus presentation sequence is readied, which happens after any /ontrialbegin logic. A picture element's currentitem property reflects the item currently selected for respective element, which /ontrialbegin is still whatever the selection was in the previous trial that performed some selection on the element. (Or nothing at all if no trial had displayed the given picture element yet, in which case it'll be the first item by default.) Moving the logic to /ontrialend is the correct approach.
Thus, when you set values.currentpic /ontrialbegin, th

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search