psychopy.org | Reference | Downloads | Github

HELP! Multiple Criterion Routines

Hello all!

What I am trying to accomplish

  • I have multiple routines (7 in total) with criterions to be met before moving onto the next criterion
  • The routines will be recorded so I can see how many trials it takes to reach criterion

What is happening/my issue

  • The history counter is still going so the first routine so when they meet criterion for the first routine, when doing the second routine, they get 1 correct and then they move on. I imagine this is because the routine did not rest some kind of accuracy history.
  • I am not able to see how many trials they took in order to reach criterion.

Here is the overall data for the routines (same for each routine)
BEGIN EXPERIMENT
total_trials = 0

avg_acc = 1

acc_hist = []

END ROUTINE
total_trials = total_trials + 1

acc_hist.append(keyResponse.corr)

if(len(acc_hist) >= 12):
acc_hist.pop(0)

avg_acc = sum(acc_hist) / len(acc_hist)

if(avg_acc >= 0.9 and total_trials >= 12):
AB.finished = True

FEEDBACK
BEGIN EXPERIMENT
soundfile = [‘correctDING.wav’,‘incorrectBUZZER.wav’]
msg = ‘whoops!’

BEGIN ROUTINE
if not keyResponse.keys :
msg=“Failed to respond”

elif keyResponse.corr:#stored on last run routine
sound = soundfile[0]
msg=“Correct!”

else:
sound = soundfile[1]
msg=“Incorrect”

Let me know what you all think and what I can do to change this for my dissertation.