# Timing Accuracy Variable

Hi guys!
I’m new on PsychoPy and new some of your help

What my experiment does?
My experiment shows 2 images for the participant and 2 response options. The participant needs to discover the relation between the 2 images and then select one of the response options clicking with mouse. Each block contains 16 trials. At the end of the block is showed the percentage of correct answers. To go to next block the participant needs a total of 80% (or more) correct answers. On the contrary the participant restarts the block.

What I want to do?
I want to add a new variable: timing accuracy! (time variable)
Therefore the participant, besides a total of 80% (or more) correct answers, he needs to responde each trial in a maximum of 3.000 miliseconds. For conclude the block the participant needs a total of 80% (or more) correct answers (this works perfectly in my experiment) and a timing accuracy ≤ 3.000 miliseconds in each trial.

How I can add this new variable?

(I’m not trying to put my experiment on Pavlovia)

Here is a sample of my experiment file:
MTS - OtM 2x3.psyexp (134.2 KB)

Thanks!

.

You could have a flag (e.g. tooSlow) which is set to False at the beginning of your block and then set to True if resp_corr.rt > 3 (or however you are recording reaction time).

Does mouse has attribute for .rt ?

In my experiment the participant use the mouse to select one of the response options.

Here my file, if it helps
MTS - OtM 2x3.psyexp (134.2 KB)

For mouse responses I tend to record the value of t in Each Frame or End Routine code (Each Frame gives a slightly shorter reaction time and is probably more accurate).

sorry for the inconvenience @wakecarter
It’s seems pretty simple, but what is the code for recording the mouse response time?

``````if mouse.isPressedIn(target): # target is the name of the object to click on
rt = round(t*1000) # t is seconds since the start of the routine
continueRoutine = False
``````

@wakecarter pretty thanks! This works perfectly

“# t is seconds since the start of the routine” what I can use if I want a variable to count since the mouse start?

Taking my code from: Saving time of first mouse movement - #3 by wakecarter

Begin Experiment

``````myClock = core.Clock() # new util.Clock() in JS
``````

Begin Routine

``````mouserec = mouse.getPos()
moved = False
tooSlow = False
``````

Each Frame

``````if moved == False:
mouseloc = mouse.getPos()
if mouseloc[0] != mouserec[0] or mouseloc[1] != mouserec[1]:
moved = True