Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Specify the response

Hi Flaad, Hi all
I have some issue in go-nogo task paradigm. Since there is an instruction not to press the key, I am little bit confused how to specify the correct response. If I not specify the “not press” as a correct result, the data will fill with none string whereas never meet the criteria. What I tried to achieve is the accuracy when subject not to press the key but the result is correct. I just outline the problem maybe something like this:

if response == "random key” and gonogo_stimulus == "yellow square":
correct_answer = "true" # press the key
if response != "random key" and gonogo_stimulus == "yellow square":
correct_answer = "false" # not press the key or miss
if response == "random key" and gonogo_stimulus == "blue square":
correct_answer = "false" # press the key that shouldnt
if response != "random key" and gonogo_stimulus == "blue square":
response_type = "true" # not press the key

I hope any further advice and comment from anyone who is ever work with go-nogo paradigm task.
Thanks a lot


  • edited December 2018

    Hi Tanto,

    I am not sure I understand the problem.

    key, rt = exp.keyboard.wait(duration=1500)
    if key is None:  #  Not responded
        if gonogo_stimulus == "blue square":
            correct = 1
            correct = -1
        if gonogo_stimulus == "yellow_square" and key = "random key":
            correct = 2
            correct = -2

    Where correct is coding: -2=missed reject, -1=false hit, 1=hit, 2=reject

  • Hi Flaad,

    Thanks for the quick response. Yes!, that's right what I really meant. I think go/nogo task have very different structure from flanker or stroop task. My understanding is that I don't need to specify the response with "trial.set_factor("corr_res",corr_res)" but just specify directly after block has started. Correct me if I'm wrong. I have been working on it. Thanks for the code, very helpful for me who is still struggling to understand Python.

  • Hi Flaad really sorry to bother you again. I have stumble upon in other error. The code give me :

    AttributeError: 'NoneType' object has no attribute 'add'
    Exception TypeError: "'NoneType' object is not callable" in > ignored

    As far as I understand this error, maybe caused by the key with 'none' response, when I try combined the data. I tried to covert the nonType with 0 :

    int(0 if key is None else None)

    But no works and raise similar error. Here my full code.

  • You get this error because you never start the experiment. The data attribute is only available after a call to expyriment.control.start. See also

  • I get the same result whatever I modify the condition. Any suggest would be great n thanks a lot

    I make my stimuli more simple to test the correct answer. I hope this help and I am very grateful for your answer.

  • That is because fast_stimuli == "cruel" and fast_stimuli == "love" can never be true, since fast_stimuli is a list, and "cruel" and "love" are strings.

  • Hello Flaad,
    After several trials, I got this code work exactly just what I want. I just simply change :
    if key is None:
    if trial.stimuli[0].text == 'cruel':
    correct = 'true miss'
    correct = 'false miss'
    if trial.stimuli[0].text == 'cruel' and expyriment.misc.constants.K_SPACE:
    correct = 'false hit'
    correct = 'true hit'
    and this is also work if I set the reaction times (rt) to None. Yes the fast_stimuli will never meet the criteria because I got the comparison logic wrong in the beginning. I attached my final code. Hope this help and many thanks for the advice.

Sign In or Register to comment.