One way to randomly combine stimuli from two different loops in OpenSesame is to use Python code.
First, define the two loops and their corresponding variables:
loop1 = items1 # first loop
loop2 = items2 # second loop
n_trials = len(loop1) # number of trials in each loop
Then, use the random
module to randomly select a trial from each loop and concatenate them:
import random
combined_items = [] # list to store combined items
for i in range(n_trials):
item1 = loop1[random.randint(0, n_trials - 1)] # randomly select a trial from loop1
item2 = loop2[random.randint(0, n_trials - 1)] # randomly select a trial from loop2
combined_items.append(item1 + item2) # concatenate the stimuli and add to the list
Finally, create a new loop using the combined_items
list:
combined_loop = [[i] for i in combined_items] # convert the list into format suitable for a loop
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2021-08-08 11:00:00 +0000
Seen: 1 times
Last updated: Feb 20
How can I set up Gunicorn with a Django Project?
Looking for a Python Module that finds Tags for a Text describing its Content
Need a Function in Python to remove entries less than 2 digits from an Array
How can I convert a Document in Python?
How can I program a Loop in Python?
How can I enable Python Code Highlighting in Askbot?