#### Howdy, Stranger!

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

Supported by

# Exogenous cueing task

Hi,

I have a randomization problem in OpenSesame.

I have to create a dot detection task driven by an exogenous spatial cue. Each trial will begin with a fixation cross (+) flanked by two blank squares on its right and left side. Then a cue (a face displaying one of 5 different emotions) will appear in one of the two squares in randomized order, followed by a dot presented in one of the two squares, in the same (valid trial; 70% of total) or in the opposite (invalid trial; 30% of the total) position as the cue (in randomized order).

I have 10 different faces for each facial expression.

So I have to randomize both the facial expressions and the trial validity considering that for each expression I should have 70% of valid trial and 30% of invalid trial.

I am not familiar with opensesame (I have used Matlab in the last studies) and I don't know how to do that.

Any help would be greatly appreciated!

Laura

## Comments

• Hi Laura,

First of all, I recommend you doing the beginner's tutorial: https://osdoc.cogsci.nl/3.2/tutorials/beginner/

This will already help to make clear how Opensesame works in general.

For your specific example, I am not sure whether you can achieve what you want to, using only the loop table and standard items. I would use inline_scripts instead.

If I understood correctly, you have 3 variables.

Emotion (5 levels) x target side (2) x cue validity (2), right?

So to make it completely counterbalanced (and have the same likelihood of invalid and valid trials at each location), you would need 100 trials.

```import random
emotions = ['emo1','emo2','emo3','emo4','emo5']
cue_pos = ['left', 'right']
cue_valid = [0,0,0,1,1,1,1,1,1,1] # 0 represents invalid, 1 is valid

trials = []

for em in emotions:
for pos in cue_pos:
for va in cue_valid:
trials.append([em,pos,va])

# shuffle everything so that you have it randomized
random.shuffle(trials)

# next you have to assign the target position based on the cue position
# and the cue validity
# also you need to select a random emotion from the emotion category, e.g.
# using random.choice()

```

This should get you started. Let us know if you need help.

Eduard

Sign In or Register to comment.