Providing average reaction time feedback and excluding missed trials

Hi I’m trying to provide average Reaction time at the end of the experiment

I got it working with this code

rt_list.append(Response.rt)
rt_array = np.array(rt_list)
mean_rt = rt_array.mean()
text = "You are done with this Block. \n\n Your reaction time was %.3f s " %(mean_rt)

However, I’m facing a problem : the missed trials

I coded:
if Response.keys in [‘’, , None]:
Response.keys = None
Response.rt = 0

But having this 0 messed up with my mean RT.
I tried to replace it by:

    Response.rt = ' ' 

or Response.rt = ‘None’

but none of this option work since it cannot calculate the mean after . Do you have any input ?

Thanks

Hi @Lysianne, would it work to just not append the Response.rt if there was no response?

1 Like

For any reason it did not like that no.
But I figured it out basically I just needed to make no-responses coded as np.nan
and then to remove the nan from my mean calculation using np.nanmean()
All good now

Thank you

Helll,

Only append the RT when the reaction is correct.

Best wishes Jens