Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

How to rerun a loop after checking accuracy ?

I am new to opensesame and I find it really cool. Get software.

I need help with the following scenario.

In my experiment, there is a learning phase and a testing phase. Participants learn words during the first phase(loop-sequence) and are tested in the second phase(loop-sequence).
After the test phase, I want to re-run the learning phase(loop) if the accuracy is less than 80%.

My problem is how do i specify, if the acc is less than 80, run this loop.

I tried python script, but its not working for me.


  • edited May 2017


    Say that you want to repeat block_loop when accuracy is less than 80%, then you could do the following:

    • Embed block_loop in another loop, here meta_loop
    • Set the repeat value for meta_loop very high (so that it's practically infinite)
    • Set the break-if statement for meta_loop to [acc] >= 80, and disable 'Evaluate on first cycle'

    Do you see the logic?


    There's much bigger issues in the world, I know. But I first have to take care of the world I know.

  • Works perfect.

    Thanks Sebastian...

  • Hi there,

    I am trying to do a similar thing and have tried this method but it seems to take the cumulative accuracy across all completed block repetitions. Is there a way to break the loop based only on accuracy of the most recent block?


  • Hi,

    If you reset the feedback in the end (or the beginning) of a block, only the most recent block should be used for the computations. So just drag the reset_feeback item in the beginning of your block_sequence and you should be set.

    Good luck.


  • That worked a treat, thanks so much!

  • edited December 2017

    Hello, I have done what sebastiaan said and it worked, but I need an extra thing.

    I need please the experiment to end if the participant didn't reach to 80% accuracy. How can I do that?
    I need the exp to end after two tries to reach 80% acc - I know how to repeat if didn't get to 80% but I don't know how to end the exp.

  • Hi @Matanel Weissman,

    I would use a simple inline_script that raises an Exception in this case. That will cause the experiment to exit. Like so:

    if var.acc < 80:
        raise Exception('Accuracy to low!')


    There's much bigger issues in the world, I know. But I first have to take care of the world I know.

Sign In or Register to comment.