Howdy, Stranger!

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

Supported by

guidance in designing loops -conditioning experiment-

Hello!

I am trying to program a conditioning experiment and I need some guidance in arranging the loops. So basically I have two CS image categories composed of 8 exemplar images. I want to randomly show 4 of the exemplars from each CS category with 5 aversive UCS images (each exemplar paired with each UCS image once in random order) and the rest of the 4 exemplars in each CS category with 5 neutral UCS images. Should I be using an inline script to make this work? I thought of using the random function but I was not sure whether I should embed the randomized exemplars into seperate lists and if so how to put the non-picked ones into another list. This also confused me while preparing the block loop trial sequence as in, should I specify each UCS image in there and if yes how should I define the CS variable since I want them all randomized for each participant.

Any guidance regarding this matter is very appreciated. It is the first time I'm trying to program in OpenSesame and I could not proceed beyond due to this confusion.

Thank you in advance!

Comments

  • Hi,

    Should I be using an inline script to make this work?

    I would, but I generally prefer inline_scripts. Maybe you can accomplish your design also with loop tables, but I can't think of an easy way to do that.

    One thing, I'm not sure I get correctly:

    4 of the exemplars from each CS category with 5 aversive UCS images (each exemplar paired with each UCS image once in random order)

    That is, 20 trials with the all 4 CS images in random order?

    So, here is a little example, that should get you started.

    import random
    
    # create the CS lists
    # if you have images, just replace the numbers with the image filenames (incl. extension, e.g. .png)
    CS_1 = [1,2,3,4,5,6,7,8]
    CS_2 = [11,12,13,14,15,16,17,18]
    
    # create more lists for the  UCS
    averse = [21,22,23,24,25]
    neutral = [31,32,33,34,35]
    
    # shuffle everything
    random.shuffle(CS_1)
    random.shuffle(CS_2)
    random.shuffle(averse)
    random.shuffle(neutral)
    
    # select which CS goes with which UCS
    neutralCS = CS_1[:4]
    averseCS = CS_1[4:]
    
    # combine all exemplars per condition
    neutralStim = [ [cs,ucs] for cs in neutralCS for ucs in neutral ]
    averseStim = [ [cs,ucs] for cs in averseCS for ucs in averse ]
    allStim = neutralStim + averseStim
    # shuffle the list that contains all trials for the CS_1 condition, so that all trials are fully randomized
    random.shuffle(allStim)
    
    # the list allStim, is now a list containing lists for each trial. Every sublist has two items, the first one
    # should be the filename of the CS image, the second one the filename of the neutral image
    # allStim you can now access one by one, for each trial and present the images accordingly
    
    # You can apply the same logic to add the lists for CS_2 files
    

    Hope this helps,

    eduard

    Buy Me A Coffee

Sign In or Register to comment.