Creating a condition for finish an experiment

Hi everyone!

What are you trying to achieve?:
if training_criterion isnt achievied in nReps$ on ab_training the experiment is ended;

How I can make it works?


There is an error in line 5 of your code, use if instead of elif. I am not sure whether this will solve your problem, since you don‘t show how you count the number of repetitions and how you want to end it.

Best wishes Jens

Hi @JensBoelte ! Thanks for replying

I don’t count the number of repetitions, until now ab_training can be repeted twice. But I’d like to do something like “if total_correct < training_criterion and ab_training was repeted twice, then experiment ends”

How I can count the number of repetitions in ab_trainining?

Hello Marcello,

each loop has a counter. Search for trials.thisN. Do you want to run the experiment online? Haven’t tried it for a while and don’t know if thisN is working when using custom names instead to trials. If you want to keep your loop names you could use an index.

Best wishes Jens

Hello Jens,

Nothing is working here :frowning:

I don’t want to run the experiment online.

I need to settle if ab_training.thisN is finished and total_correct != training_criterion then experiment ends

Hello Marcello,

I do not yet quite understand what your break-up criteria are. Please find attached a PsychPy-experiment that finishes after six correct answers (press left, when you see left and right when you see right) or six trials.

Criterion.psyexp (15.6 KB)

Stimuli.xlsx (8.5 KB)

See here for attributes of the trial-handler

Best wishes Jens