Millisecond Forums

Adding image before each stimuli is presented

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

By swifty_the_fox - 11/15/2021

Hi guys, 

I am modifying the Penn Emotion Recognition Task (ER-40), which presents images of faces and then has the subject choose what emotion they saw. I would like to simply add another image before each face is shown, but I am struggling on how to do this. Where in the code can I add the image?

<trial emotionRecognition>
/ inputdevice = mouse
/ ontrialbegin = [
    values.target = list.itemnumbers.nextindex;
    if (substring(item.images.item(values.target), 0, 1) == "F"){
        values.gender = 1;
    } else {
        values.gender = 2;
    };
    
    if (substring(item.images.item(values.target), 1, 1) == "H"){
        values.emotion = 1;
    } else if (substring(item.images.item(values.target), 1, 1) == "S"){
        values.emotion = 2;
    } else if (substring(item.images.item(values.target), 1, 1) == "A"){
        values.emotion = 3;
    } else if (substring(item.images.item(values.target), 1, 1) == "F"){
        values.emotion = 4;
    } else if (substring(item.images.item(values.target), 1, 1) == "N"){
        values.emotion = 5;
    };
    
    if (substring(item.images.item(values.target), 2, 1) == "X"){
        values.intensity = 1;
    } else if (substring(item.images.item(values.target), 2, 1) == "Z"){
        values.intensity = 2;
    } else {
        values.intensity = 0;
    };
    
]
/ stimulusframes = [1 = target, happy, sad, anger, fear, neutral, wall, testInstructions1, testInstructions2]
/ validresponse = (happy, sad, anger, fear, neutral)
/ iscorrectresponse = [
    return(
    (trial.emotionRecognition.response == "happy" && values.emotion == 1) ||
    (trial.emotionRecognition.response == "sad" && values.emotion == 2) ||    
    (trial.emotionRecognition.response == "anger" && values.emotion == 3) ||    
    (trial.emotionRecognition.response == "fear" && values.emotion == 4) ||    
    (trial.emotionRecognition.response == "neutral" && values.emotion == 5));    
]
/ ontrialend = [
    values.countCorrect += trial.emotionRecognition.correct;
    list.ACC.appenditem(trial.emotionRecognition.correct);
    if (trial.emotionRecognition.correct){
        list.corrRT.appenditem(trial.emotionRecognition.latency);
    };
    list.RT.appenditem(trial.emotionRecognition.latency);
]
/ posttrialpause = parameters.ITI
</trial>

<trial finish>
/ inputdevice = mouse
/ ontrialbegin = [
    if (parameters.showSummaryFeedback == false){
        text.SummaryFeedback.skip = true;
    };
]
/ stimulusframes = [1 = clearscreen, thankYou, SummaryFeedback, finish]
/ validresponse = (finish)
/ recorddata = false
</trial>


By Dave - 11/15/2021

swifty_the_fox - 11/15/2021
Hi guys, 

I am modifying the Penn Emotion Recognition Task (ER-40), which presents images of faces and then has the subject choose what emotion they saw. I would like to simply add another image before each face is shown, but I am struggling on how to do this. Where in the code can I add the image?

<trial emotionRecognition>
/ inputdevice = mouse
/ ontrialbegin = [
    values.target = list.itemnumbers.nextindex;
    if (substring(item.images.item(values.target), 0, 1) == "F"){
        values.gender = 1;
    } else {
        values.gender = 2;
    };
    
    if (substring(item.images.item(values.target), 1, 1) == "H"){
        values.emotion = 1;
    } else if (substring(item.images.item(values.target), 1, 1) == "S"){
        values.emotion = 2;
    } else if (substring(item.images.item(values.target), 1, 1) == "A"){
        values.emotion = 3;
    } else if (substring(item.images.item(values.target), 1, 1) == "F"){
        values.emotion = 4;
    } else if (substring(item.images.item(values.target), 1, 1) == "N"){
        values.emotion = 5;
    };
    
    if (substring(item.images.item(values.target), 2, 1) == "X"){
        values.intensity = 1;
    } else if (substring(item.images.item(values.target), 2, 1) == "Z"){
        values.intensity = 2;
    } else {
        values.intensity = 0;
    };
    
]
/ stimulusframes = [1 = target, happy, sad, anger, fear, neutral, wall, testInstructions1, testInstructions2]
/ validresponse = (happy, sad, anger, fear, neutral)
/ iscorrectresponse = [
    return(
    (trial.emotionRecognition.response == "happy" && values.emotion == 1) ||
    (trial.emotionRecognition.response == "sad" && values.emotion == 2) ||    
    (trial.emotionRecognition.response == "anger" && values.emotion == 3) ||    
    (trial.emotionRecognition.response == "fear" && values.emotion == 4) ||    
    (trial.emotionRecognition.response == "neutral" && values.emotion == 5));    
]
/ ontrialend = [
    values.countCorrect += trial.emotionRecognition.correct;
    list.ACC.appenditem(trial.emotionRecognition.correct);
    if (trial.emotionRecognition.correct){
        list.corrRT.appenditem(trial.emotionRecognition.latency);
    };
    list.RT.appenditem(trial.emotionRecognition.latency);
]
/ posttrialpause = parameters.ITI
</trial>

<trial finish>
/ inputdevice = mouse
/ ontrialbegin = [
    if (parameters.showSummaryFeedback == false){
        text.SummaryFeedback.skip = true;
    };
]
/ stimulusframes = [1 = clearscreen, thankYou, SummaryFeedback, finish]
/ validresponse = (finish)
/ recorddata = false
</trial>



You'll want to replace /stimulusframes in <trial emotionRecognition> with /stimulustimes and define whatever timing and sequence of stimuli you want there.
https://www.millisecond.com/support/docs/v6/html/language/attributes/stimulustimes.htm

Basics like this you will find covered in the tutorials in the Inquisit documentation. https://www.millisecond.com/support/docs/v6/html/tutorials/covert_attention/cacreatingtrials.htm


By swifty_the_fox - 11/16/2021

Dave - 11/15/2021
swifty_the_fox - 11/15/2021
Hi guys, 

I am modifying the Penn Emotion Recognition Task (ER-40), which presents images of faces and then has the subject choose what emotion they saw. I would like to simply add another image before each face is shown, but I am struggling on how to do this. Where in the code can I add the image?

<trial emotionRecognition>
/ inputdevice = mouse
/ ontrialbegin = [
    values.target = list.itemnumbers.nextindex;
    if (substring(item.images.item(values.target), 0, 1) == "F"){
        values.gender = 1;
    } else {
        values.gender = 2;
    };
    
    if (substring(item.images.item(values.target), 1, 1) == "H"){
        values.emotion = 1;
    } else if (substring(item.images.item(values.target), 1, 1) == "S"){
        values.emotion = 2;
    } else if (substring(item.images.item(values.target), 1, 1) == "A"){
        values.emotion = 3;
    } else if (substring(item.images.item(values.target), 1, 1) == "F"){
        values.emotion = 4;
    } else if (substring(item.images.item(values.target), 1, 1) == "N"){
        values.emotion = 5;
    };
    
    if (substring(item.images.item(values.target), 2, 1) == "X"){
        values.intensity = 1;
    } else if (substring(item.images.item(values.target), 2, 1) == "Z"){
        values.intensity = 2;
    } else {
        values.intensity = 0;
    };
    
]
/ stimulusframes = [1 = target, happy, sad, anger, fear, neutral, wall, testInstructions1, testInstructions2]
/ validresponse = (happy, sad, anger, fear, neutral)
/ iscorrectresponse = [
    return(
    (trial.emotionRecognition.response == "happy" && values.emotion == 1) ||
    (trial.emotionRecognition.response == "sad" && values.emotion == 2) ||    
    (trial.emotionRecognition.response == "anger" && values.emotion == 3) ||    
    (trial.emotionRecognition.response == "fear" && values.emotion == 4) ||    
    (trial.emotionRecognition.response == "neutral" && values.emotion == 5));    
]
/ ontrialend = [
    values.countCorrect += trial.emotionRecognition.correct;
    list.ACC.appenditem(trial.emotionRecognition.correct);
    if (trial.emotionRecognition.correct){
        list.corrRT.appenditem(trial.emotionRecognition.latency);
    };
    list.RT.appenditem(trial.emotionRecognition.latency);
]
/ posttrialpause = parameters.ITI
</trial>

<trial finish>
/ inputdevice = mouse
/ ontrialbegin = [
    if (parameters.showSummaryFeedback == false){
        text.SummaryFeedback.skip = true;
    };
]
/ stimulusframes = [1 = clearscreen, thankYou, SummaryFeedback, finish]
/ validresponse = (finish)
/ recorddata = false
</trial>



You'll want to replace /stimulusframes in <trial emotionRecognition> with /stimulustimes and define whatever timing and sequence of stimuli you want there.
https://www.millisecond.com/support/docs/v6/html/language/attributes/stimulustimes.htm

Basics like this you will find covered in the tutorials in the Inquisit documentation. https://www.millisecond.com/support/docs/v6/html/tutorials/covert_attention/cacreatingtrials.htm



Thank you very much! I have been able to make that work well.

Additionally, I would like to present an image a single time before the /stimulustimes begins. How do I stop it from being presented after the first time?
By Dave - 11/16/2021

swifty_the_fox - 11/16/2021
Dave - 11/15/2021
swifty_the_fox - 11/15/2021
Hi guys, 

I am modifying the Penn Emotion Recognition Task (ER-40), which presents images of faces and then has the subject choose what emotion they saw. I would like to simply add another image before each face is shown, but I am struggling on how to do this. Where in the code can I add the image?

<trial emotionRecognition>
/ inputdevice = mouse
/ ontrialbegin = [
    values.target = list.itemnumbers.nextindex;
    if (substring(item.images.item(values.target), 0, 1) == "F"){
        values.gender = 1;
    } else {
        values.gender = 2;
    };
    
    if (substring(item.images.item(values.target), 1, 1) == "H"){
        values.emotion = 1;
    } else if (substring(item.images.item(values.target), 1, 1) == "S"){
        values.emotion = 2;
    } else if (substring(item.images.item(values.target), 1, 1) == "A"){
        values.emotion = 3;
    } else if (substring(item.images.item(values.target), 1, 1) == "F"){
        values.emotion = 4;
    } else if (substring(item.images.item(values.target), 1, 1) == "N"){
        values.emotion = 5;
    };
    
    if (substring(item.images.item(values.target), 2, 1) == "X"){
        values.intensity = 1;
    } else if (substring(item.images.item(values.target), 2, 1) == "Z"){
        values.intensity = 2;
    } else {
        values.intensity = 0;
    };
    
]
/ stimulusframes = [1 = target, happy, sad, anger, fear, neutral, wall, testInstructions1, testInstructions2]
/ validresponse = (happy, sad, anger, fear, neutral)
/ iscorrectresponse = [
    return(
    (trial.emotionRecognition.response == "happy" && values.emotion == 1) ||
    (trial.emotionRecognition.response == "sad" && values.emotion == 2) ||    
    (trial.emotionRecognition.response == "anger" && values.emotion == 3) ||    
    (trial.emotionRecognition.response == "fear" && values.emotion == 4) ||    
    (trial.emotionRecognition.response == "neutral" && values.emotion == 5));    
]
/ ontrialend = [
    values.countCorrect += trial.emotionRecognition.correct;
    list.ACC.appenditem(trial.emotionRecognition.correct);
    if (trial.emotionRecognition.correct){
        list.corrRT.appenditem(trial.emotionRecognition.latency);
    };
    list.RT.appenditem(trial.emotionRecognition.latency);
]
/ posttrialpause = parameters.ITI
</trial>

<trial finish>
/ inputdevice = mouse
/ ontrialbegin = [
    if (parameters.showSummaryFeedback == false){
        text.SummaryFeedback.skip = true;
    };
]
/ stimulusframes = [1 = clearscreen, thankYou, SummaryFeedback, finish]
/ validresponse = (finish)
/ recorddata = false
</trial>



You'll want to replace /stimulusframes in <trial emotionRecognition> with /stimulustimes and define whatever timing and sequence of stimuli you want there.
https://www.millisecond.com/support/docs/v6/html/language/attributes/stimulustimes.htm

Basics like this you will find covered in the tutorials in the Inquisit documentation. https://www.millisecond.com/support/docs/v6/html/tutorials/covert_attention/cacreatingtrials.htm



Thank you very much! I have been able to make that work well.

Additionally, I would like to present an image a single time before the /stimulustimes begins. How do I stop it from being presented after the first time?

> Additionally, I would like to present an image a single time before the /stimulustimes begins. How do I stop it from being presented after the first time?

Set up a trial that does notthing but display that image, run it a single time.

<block emotionRecognition>
/ trials = [
    1 = thetrialthatdisplaystheimagethatyouonlywantdisplayedasingletime;
    2-41 = emotionRecognition;
    42 = finish;
]
</block>
By swifty_the_fox - 11/16/2021

Dave - 11/16/2021
swifty_the_fox - 11/16/2021
Dave - 11/15/2021
swifty_the_fox - 11/15/2021
Hi guys, 

I am modifying the Penn Emotion Recognition Task (ER-40), which presents images of faces and then has the subject choose what emotion they saw. I would like to simply add another image before each face is shown, but I am struggling on how to do this. Where in the code can I add the image?

<trial emotionRecognition>
/ inputdevice = mouse
/ ontrialbegin = [
    values.target = list.itemnumbers.nextindex;
    if (substring(item.images.item(values.target), 0, 1) == "F"){
        values.gender = 1;
    } else {
        values.gender = 2;
    };
    
    if (substring(item.images.item(values.target), 1, 1) == "H"){
        values.emotion = 1;
    } else if (substring(item.images.item(values.target), 1, 1) == "S"){
        values.emotion = 2;
    } else if (substring(item.images.item(values.target), 1, 1) == "A"){
        values.emotion = 3;
    } else if (substring(item.images.item(values.target), 1, 1) == "F"){
        values.emotion = 4;
    } else if (substring(item.images.item(values.target), 1, 1) == "N"){
        values.emotion = 5;
    };
    
    if (substring(item.images.item(values.target), 2, 1) == "X"){
        values.intensity = 1;
    } else if (substring(item.images.item(values.target), 2, 1) == "Z"){
        values.intensity = 2;
    } else {
        values.intensity = 0;
    };
    
]
/ stimulusframes = [1 = target, happy, sad, anger, fear, neutral, wall, testInstructions1, testInstructions2]
/ validresponse = (happy, sad, anger, fear, neutral)
/ iscorrectresponse = [
    return(
    (trial.emotionRecognition.response == "happy" && values.emotion == 1) ||
    (trial.emotionRecognition.response == "sad" && values.emotion == 2) ||    
    (trial.emotionRecognition.response == "anger" && values.emotion == 3) ||    
    (trial.emotionRecognition.response == "fear" && values.emotion == 4) ||    
    (trial.emotionRecognition.response == "neutral" && values.emotion == 5));    
]
/ ontrialend = [
    values.countCorrect += trial.emotionRecognition.correct;
    list.ACC.appenditem(trial.emotionRecognition.correct);
    if (trial.emotionRecognition.correct){
        list.corrRT.appenditem(trial.emotionRecognition.latency);
    };
    list.RT.appenditem(trial.emotionRecognition.latency);
]
/ posttrialpause = parameters.ITI
</trial>

<trial finish>
/ inputdevice = mouse
/ ontrialbegin = [
    if (parameters.showSummaryFeedback == false){
        text.SummaryFeedback.skip = true;
    };
]
/ stimulusframes = [1 = clearscreen, thankYou, SummaryFeedback, finish]
/ validresponse = (finish)
/ recorddata = false
</trial>



You'll want to replace /stimulusframes in <trial emotionRecognition> with /stimulustimes and define whatever timing and sequence of stimuli you want there.
https://www.millisecond.com/support/docs/v6/html/language/attributes/stimulustimes.htm

Basics like this you will find covered in the tutorials in the Inquisit documentation. https://www.millisecond.com/support/docs/v6/html/tutorials/covert_attention/cacreatingtrials.htm



Thank you very much! I have been able to make that work well.

Additionally, I would like to present an image a single time before the /stimulustimes begins. How do I stop it from being presented after the first time?

> Additionally, I would like to present an image a single time before the /stimulustimes begins. How do I stop it from being presented after the first time?

Set up a trial that does notthing but display that image, run it a single time.

<block emotionRecognition>
/ trials = [
    1 = thetrialthatdisplaystheimagethatyouonlywantdisplayedasingletime;
    2-41 = emotionRecognition;
    42 = finish;
]
</block>

Ah, thank you very much!