Hello people,
I am having problems with the code of my experiment. I needed to create practice trails that are different from the main trails and from the practice trails I want to take only 6. I have try to do it in the coder but now the practice trails do not appear when I run the experiment.
Here is the code where I think there is problems:
Define practice and main trial lists based on the ‘Practice’ column
practiceTrials = [trial for trial in trialList if trial[‘Practice’] == 1]
mainTrials = [trial for trial in trialList if trial[‘Practice’] == 0]
Present trials
for procedure in [‘practice’]:
practice_experiment = data.TrialHandler(trialList = practiceTrials, nReps = 1, method = "random")
thisExp.addLoop(practice_experiment) # add a trial loop to the experiment
for procedure in [‘main’]:
experiment = data.TrialHandler(trialList = mainTrials, nReps = 1, method = "random")
thisExp.addLoop(experiment) # add a trial loop to the experiment
# Main or practice trials
if procedure == 'main':
maxTrials = len(mainTrials)
# Repeat instructions
instructionsRepeatText.draw()
win.flip()
resp = event.waitKeys(keyList = ['space','escape'])
escape(resp)
else:
maxTrials = npracticeTrials
selectedPracticeTrials = practiceTrials[:maxTrials]
# Iterate over trials
for t, trial in enumerate(practice_experiment if procedure == 'practice' else experiment):
if t < maxTrials:
# Show fixation cross
fixationText.draw()
win.flip()
core.wait(1) # Duration = 1000ms
# Show target images ... etc.
Thank you in advance for your time.