Create Two Identical Lists
I'm trying to implement an easy recognition memory experiment with a learning phase and a recalling phase. So I need 2 lists of stimuli that are identical. They should contain the name of the stimulus (stimName) and the category (reconCateg).
To do this I implemented an in_line script at the beginning that creates a list (reconCateg ), shuffles the category variable and copies the list in two separate lists (reconCategLearningGlobal, reconCategReconGlobal).
from random import shuffle #import shuffle var.reconCateg = [1, 1, 0, 0] #create category list var.reconCateg = list(var.reconCateg) #coerce to list #create stimuli list var.stimName = ["WM-004", "WM-006", "WM-222", "WM-252"] #shuffle category list var.reconCateg = shuffle(var.reconCateg) #copy category list for learning phase var.reconCategLearningGlobal = list(var.reconCateg) #copy category list for recognition phase var.reconCategReconGlobal = list(var.reconCateg)
Subsequently, only stimuli that are not distractors (value 1 in reconCateg) are displayed in the learning phase while all stimuli of the second list are displayed in the recognition phase.
To import the lists to be used in each phase I used another in_line script (one for each phase)
#import the last item of the list for each iteration var.reconCategLearning = var.reconCategLearningGlobal.pop()
Now I have this error:
'NoneType' object is not iterable
in the in_line script at the beginning. I think it is due to coercing reconCateg to a list, that I need to do to avoid getting the "has no pop attribute" error in the second in_line.
Have you any idea about how to resolve this issue? Or any suggestion to run an experiment as simple as this?
Thanks a lot!!