Feedback message in go/no-go task

I’m trying to provide a feedback message after a classical go/no-go task: If a certain stimulus appears, the participants have to press a button, for the rest of the stimuli, they don’t have to press a button. Not pressing a button will in this case be recorded as a correct answer. After the stimulus has appeared, I would like to show a feedback message, telling the participants whether their answer (either a button press or no answer) was correct or not.
I have tried several versions now, implementing many ideas that I read in the forums, but it still does not seem to work for me. My current code looks like this:

if keyresponse.keys == “None” and response == “None”:
feedback_color = “green”
if keyresponse.keys == “m” and response == “m”:
msg = “Correct”
feedback_color = “green”
msg = “Incorrect”
feedback_color = “red”

This code works correctly whenever the participants press the right button (“m” on the keyboard), but it always shows “incorrect” whenever the participants correctly give no answer.

Another option that I tried was to access the “correct = 1” and “incorrect = 0” column from my dataset, as it is correctly stored in there.

if corrAns == “1”:
feedback_color = “green”
if corrAns == “0”:
msg = “Incorrecto”
feedback_color = “red”

When using this code, the no-response trials get classified as “correct”, but only if I have pressed a button before. This means that when the first stimulus is a stimulus where it is correct to not respond, the feedback message still shows “Incorrect”, even though in the dataset it appears as “1” (correct). Hence, until I have pressed a button, the feedback messages are not correct with this version.

Do you have any idea what am I doing wrong? How is it possible to implement the right feedback messages in a go/no-go task?

Thanks in advance!

i have this problem too. did you fix it?

Hi there, I made a minimal demo to show feedback for a GNG task.

gng_fb.psyexp (12.4 KB)
conditionsFile.xlsx (17.9 KB)

Hope this helps,
Sue Lynn