Howdy, Stranger!

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

Supported by

[open] randomisation of variables

edited March 2014 in OpenSesame

Hi,

I’m relatively new to Open Sesame and have a question about randomisation. In my experiment, one trial consists of reading a paragraph of text followed by a brief video clip, after which the participant answers a question about the video clip.

There are four different categories of written text, with each category containing 16 different paragraphs (i.e. a total of 64 different texts). For the videos, I use the same four categories – in each category there are four different actors (2 male, 2 female) so that there are 16 different video clips.
For the randomisation of my experiment, I would like each of the four text categories to be shown with all 16 video clips so that each individual text is only ever seen once, whereas the videos are each shown four times over the course of the experiment. However, I want to ensure that the video clips are NOT repeated within the same text category. So for example, if the text category is ‘dominant’ then I want each individual text to be shown with male actor 1 dominant, male actor 1 submissive, male actor 1 neutral, male actor 1 aversive, male actor 2 dominant, and so on, but I don’t want to show male actor 1 dominant again with a dominant text.

I hope this makes sense. Thanks a lot for any help you can give me!

Cheers,
Jorien

Comments

  • edited 11:17PM

    Hi Jorien,

    If I understand correctly, you do not want to repeat any combination of video and category, am I right?

    To accomplish this, you could do something like the following. First, before the block (typically at the start of the block_sequence) create an empty list that will be used to keep track of which trials we've already seen, like so:

    # An empty list to keep track of which combinations of video and category have
    # been seen already.
    videoCatList = []
    

    Then, at the start of the trial_sequence, insert the following code in the prepare phase of an inline_script. See code comments for explanation. This script assumes that you have a variable video and a variable category, but you can change this to match the names used in your experiment.

    # Create a unique identifier key based on category and video, which should not
    # be repeated.
    videoCatKey = '%s-%s' % (self.get('category'), self.get('video'))
    if videoCatKey in videoCatList:
        # If we've already seen this key, then skip this trial
        exp.set('skipTrial', 1)
    else:
        # Otherwise, don't skip this trial and remember the key
        exp.set('skipTrial', 0)
        videoCatList.append(videoCatKey)
    

    This will give us the variable skipTrial that can be used to skip all items in the trial_sequence, with the following run-if statement:

    [skipTrial] = 1
    

    is that what you have in mind?

    Cheers,
    Sebastiaan

Sign In or Register to comment.