psychopy.org | Reference | Downloads | Github

Correct trials percentage threshold and condition order randomisation

You’re welcome. And, yes, having a high number of repetitions is still necessary.

Also, I noticed a small bug that I introduced: “dur=1.0” should come before the if-condition. As it never changes, it might be even better to put it under the “Begin Experiment” tab though (alternatively, you could simply set the duration of the text component “feedback_message” to 1.0, and not use “dur” at all).

Jan

Oh, one more thing. :slight_smile: If 80% is good enough, this should change:

if accuracy > minAccuracy:

to

if accuracy >= minAccuracy:

Jan

Hi Jan,

I’ve tried to introduce a ‘Your score was too low’ message in the loop to appear at the end of 10 trials, but at the moment it’s only appearing after 1 incorrect trial.

The low score message is a separate text/resp routine placed after the feedback part of the practice/feedback loop.

Thanks,

Josh

Hello Jan,

I have used the above code in my own experiment to end the routine once participants complete a minimum number of trials and reach a percent accuracy. The code works perfectly for ending the routine.
However, when I’m trying to link my experiment to pavlovia, the experiment gets stuck on the initialising experiment screen. When I look at the developer tools on chrome it says the following error: Uncaught SyntaxError: Illegal break statement
So I tried to fix this in the code I’m using by changing it to a while statement. However, if I change both the top and bottom if to whiles, then the code no longer works. I was wondering if you know what the solution might be for this code so that it will translate to pavlovia?
Here is the code I have been using:
respcorrs.append(resp.corr);

while len(respcorrs) >= minNrPractice:

respcorrsRecent = respcorrs[-considerNrTrials:];

respcorrsSum = sum(respcorrsRecent); 

accuracy = float(respcorrsSum)/considerNrTrials;

if accuracy > minAccuracy:
    break;

if len(respcorrs)>maxNrPractice:
break;

Thanks,

Ellen