Millisecond Forums

Trial/block in randomisation

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

By SCHAMP - 9/25/2019

Hi,

We are showing 16 blocks, with 8 images presented in each block (this is the same image shown 8 times).
The images are facial expressions shown by a child’s caregiver and a stranger, so that:
Block HC = Happy Caregiver. The same image is shown 8 times, before another block is shown in randomized order. For your reference:
HS = Happy Stranger
FC = Fearful Caregiver
FS = Fearful Stranger
AC = Anger Caregiver
AS = Anger Stranger
NC = Neutral Caregiver
NS = Neutral Stranger

The trial starts with a fixation cross (1000ms), followed by the image (3000ms), and an inter-trial interval (1000ms).

We have loop/s now working where we press 1 to initiate a looming ball (to grab attention of child if they are not looking at the screen) and space to initiate a trial.

However, our Neutral Stranger block/trials keep playing beyond the 8 times we would like it to be shown.
We think that this has to do with the line of code below; however, unsure how to best fix this.

Thank you!

<trial ITI>
/ stimulusframes = [1 = picture.fixation]
/trialduration = parameters.ITI
/ ontrialend = [
trial.ITI.resetstimulusframes();
]
/recorddata = false
/ branch = [
            if (script.currentblock== "HC") trial.HC
            if (script.currentblock =="HS") trial.HS;
            if (script.currentblock =="AC") trial.AC;
            if (script.currentblock =="AS") trial.AS;
            if (script.currentblock =="FC") trial.FC;
            if (script.currentblock =="FS") trial.FS;
            if (script.currentblock =="NC") trial.NC;
            else if (script.currentblock =="NS") trial.NS;
]
</trial>

<trial blank>
/ stimulusframes = [1 = picture.blank]
/trialduration = parameters.ITI
/ ontrialend = [
trial.blank.resetstimulusframes();
]
/recorddata = false
/ branch = [
            trial.start
]
</trial>

<trial start>
/ validresponse = (20,2)
/ branch = [
if (trial.start.response == 2) trial.ball
else if (trial.start.response == 20) trial.ITI;
]
/ recorddata = false
</trial>


<trial ball>
/ stimulusframes = [1 = video.ballani]
/ validresponse = (20)
/ branch = [
trial.start;
]
/ recorddata = false
</trial>
By Dave - 9/25/2019

SCHAMP - 9/25/2019
Hi,

We are showing 16 blocks, with 8 images presented in each block (this is the same image shown 8 times).
The images are facial expressions shown by a child’s caregiver and a stranger, so that:
Block HC = Happy Caregiver. The same image is shown 8 times, before another block is shown in randomized order. For your reference:
HS = Happy Stranger
FC = Fearful Caregiver
FS = Fearful Stranger
AC = Anger Caregiver
AS = Anger Stranger
NC = Neutral Caregiver
NS = Neutral Stranger

The trial starts with a fixation cross (1000ms), followed by the image (3000ms), and an inter-trial interval (1000ms).

We have loop/s now working where we press 1 to initiate a looming ball (to grab attention of child if they are not looking at the screen) and space to initiate a trial.

However, our Neutral Stranger block/trials keep playing beyond the 8 times we would like it to be shown.
We think that this has to do with the line of code below; however, unsure how to best fix this.

Thank you!

<trial ITI>
/ stimulusframes = [1 = picture.fixation]
/trialduration = parameters.ITI
/ ontrialend = [
trial.ITI.resetstimulusframes();
]
/recorddata = false
/ branch = [
            if (script.currentblock== "HC") trial.HC
            if (script.currentblock =="HS") trial.HS;
            if (script.currentblock =="AC") trial.AC;
            if (script.currentblock =="AS") trial.AS;
            if (script.currentblock =="FC") trial.FC;
            if (script.currentblock =="FS") trial.FS;
            if (script.currentblock =="NC") trial.NC;
            else if (script.currentblock =="NS") trial.NS;
]
</trial>

<trial blank>
/ stimulusframes = [1 = picture.blank]
/trialduration = parameters.ITI
/ ontrialend = [
trial.blank.resetstimulusframes();
]
/recorddata = false
/ branch = [
            trial.start
]
</trial>

<trial start>
/ validresponse = (20,2)
/ branch = [
if (trial.start.response == 2) trial.ball
else if (trial.start.response == 20) trial.ITI;
]
/ recorddata = false
</trial>


<trial ball>
/ stimulusframes = [1 = video.ballani]
/ validresponse = (20)
/ branch = [
trial.start;
]
/ recorddata = false
</trial>

<trial ITI>
/ stimulusframes = [1 = picture.fixation]
/trialduration = parameters.ITI
/ ontrialend = [
trial.ITI.resetstimulusframes();
]
/recorddata = false
/ branch = [
            if (script.currentblock== "HC") trial.HC
            if (script.currentblock =="HS") trial.HS;
            if (script.currentblock =="AC") trial.AC;
            if (script.currentblock =="AS") trial.AS;
            if (script.currentblock =="FC") trial.FC;
            if (script.currentblock =="FS") trial.FS;
            if (script.currentblock =="NC") trial.NC;
            else if (script.currentblock =="NS") trial.NS;
]
</trial>

The else does not belong and should be removed.

Also note, in general, that every instance of <trial HC>, <trial HS>, etc. you invoke via /branch will be *in addition* to the eight instances you run directly via the <block>:

<block NS>
/ trials = [1-8 = NS]
</block>

It's entirely unclear to me whether that's what you intended or not. If not, you should not invoke any additional instances via /branch.
By SCHAMP - 9/25/2019

Hi Dave, 

Thank you for your quick response and for alerting us to the how there are additional instances via /branch.

We have deleted the else; however, this still results in the NS being displayed repeatedly, regardless of whenever the block is presented in the randomisation sequence. The other blocks (HC, HS, etc.) all display correctly, with the image being presented for a maximum of 8 times (8 trials). Also, when we initiate the looming ball (pressing '1') and then return back to the expt, it correctly pauses and then resumes the block after pressing 't' (initiating trial ITI) for all blocks except NS. 

We only want the total of trials for all image types to be 8 across the whole experiment, how do I do that?

Thank you!
By Dave - 9/25/2019

SCHAMP - 9/25/2019
Hi Dave, 

Thank you for your quick response and for alerting us to the how there are additional instances via /branch.

We have deleted the else; however, this still results in the NS being displayed repeatedly, regardless of whenever the block is presented in the randomisation sequence. The other blocks (HC, HS, etc.) all display correctly, with the image being presented for a maximum of 8 times (8 trials). Also, when we initiate the looming ball (pressing '1') and then return back to the expt, it correctly pauses and then resumes the block after pressing 't' (initiating trial ITI) for all blocks except NS. 

We only want the total of trials for all image types to be 8 across the whole experiment, how do I do that?

Thank you!

As I said, if you only want the 8 trials you've specified directly in the <block> element's trials attribute, you should NOT /branch at all. I.e. all this

<trial ITI>
/ stimulusframes = [1 = text.fixation]
/trialduration = parameters.ITI
/ ontrialend = [
trial.ITI.resetstimulusframes();
]
/recorddata = false
/ branch = [
if (script.currentblock== "HC") trial.HC
if (script.currentblock =="HS") trial.HS;
if (script.currentblock =="AC") trial.AC;
if (script.currentblock =="AS") trial.AS;
if (script.currentblock =="FC") trial.FC;
if (script.currentblock =="FS") trial.FS;
if (script.currentblock =="NC") trial.NC;
if (script.currentblock =="NS") trial.NS;
]

</trial>

needs to be removed.

By SCHAMP - 9/26/2019

Thank you, Dave! This works properly now.
Much appreciated