Help with a script
Hi Opensesame people!
I am building a working memory task for my PhD work. The description of the task is as follows:
_ A black “+” symbol is displayed at the center of the screen for 500 ms as a reminder to the participants to pay attention. Subsequently, a blank screen is displayed for approximately 600 ms before a letter series appears. The letter series contains 4–12 uppercase letters that appear sequentially, with each letter being displayed for 750 ms. After the letter series disappears, three of the letters reappear at the center of the screen for approximately 1500 ms. Participants must determine whether these **three letters were the last three letters of the previously displayed series**_.
I have attached the experiment file below.
I have the following variables:
Stimulus_set (4 to12) X Target (Present vs absent/"on" vs "off")
In order to present letters I have written the following inline code:
letters = list(string.ascii_uppercase)
stimlist = random.sample(letters, var.Stimulus_set)
canvas_letters = ['x']*13 ## creating an empty list
for i in range(0,len(stimlist)):
canvas_letters[i] = stimlist[i] ## filling the list with real letters
if var.Target == "On":
var.tar = canvas_letters[-3:] ## extracting last three items from the series of letters
if var.Target == "Off":
var.ntar = random.sample(letters, 3)
**The problem is that during the target condition the task sometimes displays Xs like ["x", "x", "x"]. **
Lastly, instead using the above code I could use for loop to loop through all the stimulus_set conditions and then make a list of letters to be displayed:
for in range(Stimulus_set):
stimlist = random.sample(letters, i)
But here I get a list out of range error.
Can anyone please guide me on this??
PS: I had a similar task that had a list out of range error while using for loop which I had posted its solution gave me the code mentioned in the start of this post.