Howdy, Stranger!

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

Supported by

[solved] Read out randomized trial list

edited May 2013 in OpenSesame


I wondered is there a way to read out the trial list that you define e.g. with the variable wizard in a block loop? More importantly, if this list is not sequential but randomized, does OpenSesame define it during the prepare phase or run phase? Or in other words, is it possible to read this list out at the beginning of the experiment or only on trial by trial base?



  • edited 5:10PM

    Hi Michel,

    In principle yes, although it involves messing with the OpenSesame internals. The loop table is available as a matrix property of a loop item. So the loop table of the block_loop is:


    This is a dictionary where the cycle number is the key. Each value in the matrix dictionary is another dictionary, where the variable name is the key and the variable value is the value (if that makes sense). So you could print out the loop table as follows:

    for cycle in exp.items['block_loop'].matrix:
        print 'Cycle %d' % cycle
        for var in exp.items['block_loop'].matrix[cycle]:
            print '%s = %s' % (var, exp.items['block_loop'].matrix[cycle][var])

    The matrix is not randomized. That only happens in the run phase of the loop. So you can't know the random order of the loop, before the loop is actually executed. However, if this is important, you could randomize the matrix yourself and set the loop order to sequential.


  • edited 5:10PM

    Thanks, thats a good advice!
    Topic can be closed!

Sign In or Register to comment.