Howdy, Stranger!

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

Supported by

Random group stimulis??

edited August 2017 in OpenSesame

Hi, I'm so much new in OpenSesame. I can't find the right way to randomize stimuli groups.
I have 5 groups of images. Every group has 3 images sequential . I would like to randomize groups for every respondents. Some of them should see firstly Pepsi group, some of them should see firstly Coca Cola group etc...

As you can see below, i need to randomize groups for every respondents.

What do i have to?

This is a fMRI research. Respondents just watch images.

Comments

  • Hey,

    There are a lot of ways to do that. Below just one example.

    1) Put an inline_script in the beginning of your experiment and paste following code in the preparephase

    # make a list with a 5 groups (basenames are enough)
    items = ['CocaCola','NescafeClassic','Fanta','Pepsi','Nutella']
    
    # use participant ID to select the group
    # "%" (modulo) returns the rest of a division,e.g. 1%2 = 1, 2%2=0,3%2 =1, 4%2=2,etc...
    
    groupID = var.subject_nr%5 # if you have 5 groups
    
    # define the order for each group
    if groupID == 0:
        orderedItems = items
    elif groupID ==1:
        orderedItems = items[1:]+ items[0]
    elif groupID ==2:
        orderedItems = items[2:]+ items[:2]
    elif groupID ==3:
        orderedItems = items[3:]+ items[:3]
    elif groupID ==4:
        orderedItems = items[4:]+ items[:4]
    
    # add the endings of each picture
    var.complete_list = []
    for o in orderedItems:
        var.complete_list.append(o+'_1.png')
        var.complete_list.append(o+'_2.png')
        var.complete_list.append(o+'_3.png')
    
    # var.complete_list will now have all the 15 trials in it. 
    
    

    Hope this helps.

    Eduard

    Buy Me A Coffee

  • Thank you so much Eduard

Sign In or Register to comment.