OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 3.1.0
Standard Standalone? (y/n) If not then what?: yes
What are you trying to achieve?:
Hi,
in a memory experiment, I have two different trial routines, routine A and routine B with the loops trialsA and trialsB. For each loop, I would select different conditions files depending on the participant number, so e.g. for participant 1 the conditions file “memory_0” should be selected, for participant 2 “memory_1” and so on. I present rectangles in different colours. The colour of the rectangles and other stimulus properties are defined in the conditions files.
What did you try to make it work?:
I inserted the following code component at the beginning of routine A which is called “trial_A”:
for thisTrials_A in trials_A:
if expInfo['participant'] == '1':
trials_A.trialList=data.importConditions('memory_0.xlsx')
elif expInfo['participant'] == '2':
trials_A.trialList=data.importConditions('memory_0_1.xlsx')
What specifically went wrong when you tried that?:
I get following error message:
rectangle_1.setLineColor(recColor)
NameError: name ‘recColor’ is not defined
“recColor” defines the color of the rectangle and is specified in the conditions file. So I guess the problem is, that there is no conditions file loaded at all. What do I have to write in the conditions line when defining the loop properties…? Does anyone have any ideas…? Looking at the script, I think the problem is, that all this
trials_A = data.TrialHandler(nReps=1, method='random',
extraInfo=expInfo, originPath=-1,
trialList=[None],
seed=None, name='trials_A')
thisExp.addLoop(trials_A) # add the loop to the experiment
thisTrials_A = trials_A.trialList[0] # so we can initialise stimuli with some values
# abbreviate parameter names if possible (e.g. rgb = thisTrials_A.rgb)
if thisTrials_A != None:
for paramName in thisTrials_A:
exec('{} = thisTrials_A[paramName]'.format(paramName))
for thisTrials_Ain trials_A:
currentLoop = trials_A
# abbreviate parameter names if possible (e.g. rgb = thisTrials_A.rgb)
if thisTrials_A != None:
for paramName in thisTrials_A:
exec('{} = thisTrials_A[paramName]'.format(paramName))
comes before my code component.
Would be great if someone had a suggestion or an idea what I could try.
If anything is unclear, please let me know!
Thanks a lot in advance!