Howdy, Stranger!

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

Supported by

how to repeat a block of randomized stimuli in a certain order?

Hi OpenSesame developers,
Thanks for creating such a useful tool for us!

I am building an experiment where participants hear a block of randomized audio stimuli, and then they see a block of visual words that are associated with the previous block of audio stimuli (each visual word is associated with a particular audio stimulus). Now how could I play the visual words in the same order that the audio stimuli were played?

Thanks a lot,
Mengzhu

Comments

  • Hi,

    In the beginning of the experiment (before entering the conditions), create a list that codes the order of stimuli. In an inline_script, put this code:

    # how many trials do you have? change that
    no_trials = 50
    
    import random
    var.seq = range(50)
    random.shuffle(var.seq)
    

    If you now select the specific stimulus you have to index this list and use the number that you get to index your stimulus list, e.g. stimulus_list[var.seq[var.trial_no]]
    The list order will be the same for both conditions.

    Hope this helps,

    eduard

  • Hi Eduard,
    Thank you very much for your prompt reply. I am not sure how to implement the second part of the description to mimic the order of the first block.

    The attached is a simplified version of the experiment. In block 1, participants see a block of 3 randomized trials of 'word'. In block 2, I would like to present the 'probe' stimuli in the same order as block 1 (if the order was 2, 1, 3 in block 1, then the order in block 2 should be word 2, word 1, word 3).

    Thanks a lot,
    Mengzhu

  • I meant something like that. So prespecify the sequences and the order before the trial loop, and access each item individually in it.

    Hope that helps.
    EDuard

    Thanked by 1Mengzhu
  • Thank you so much for your time and the nice code!

  • Hi Eduard,
    Thank you very much for the clarification and code.
    Is there any way of adding more variables to the loop so that these variables can be included in the csv results file? I have added the correct responses for the trials, and it looks like it works. However, it does not work for other variables that I added, for example, in the results file, the [condition] variable did not appear in coordination with [probe] variable. Also in the results file, the [sent] variable is not correctly listed as [probe]. I attached the modified version of the experiment.

    Thanks a lot,
    Mengzhu

  • All variables that are defined in a loop table or in inline_scripts with var preceding them (e.g. var.variable_name are being written to file by default. So adding variables, means you have to define them somewhere.

    Having seen your experiment, I don't see any variables that shouldn't appear in the log file. Are you sure that there is a problem? And if so, what exactly is it?

    Eduard

Sign In or Register to comment.