Hello all,
So within this code I have 1 block, with six trials in it. What I wish to do is to duplicate the trials, such that I have 12 of them. These will still be randomised in terms of order of when the trials appear, and ditto for the positions. What I would like is two conditions for each block. In the deceptive condition (6 trials), the subjects would be required to lie, and in the truthful condition the S’s would be required to tell the truth(6 trials). So, essentially what I could do is just duplicate the for loop, or just change the Nreps to 2. However, I do wish to hard code the information. That said, I am not sure how to incorporate what I think is an ‘if’ statement into the code, in order to achieve this. I would like the data output to remain the same, but of course with the results for each condition seperated.
print('Created EXPinfo')
#This section creates the trials
Matrix = [[0 for x in xrange(6)] for x in xrange(6)]
Matrix[0][0] = 1
Matrix[0][1] = 2
Matrix[0][2] = 5
Matrix[0][3] = 6
Matrix[0][4] = 7
Matrix[0][5] = 8
Matrix[1][0] = 1
Matrix[1][1] = 3
Matrix[1][2] = 9
Matrix[1][3] = 11
Matrix[1][4] = 7
Matrix[1][5] = 12
Matrix[2][0] = 1
Matrix[2][1] = 4
Matrix[2][2] = 9
Matrix[2][3] = 12
Matrix[2][4] = 6
Matrix[2][5] = 10
Matrix[3][0] = 2
Matrix[3][1] = 3
Matrix[3][2] = 8
Matrix[3][3] = 10
Matrix[3][4] = 5
Matrix[3][5] = 9
Matrix[4][0] = 2
Matrix[4][1] = 4
Matrix[4][2] = 8
Matrix[4][3] = 11
Matrix[4][4] = 7
Matrix[4][5] = 12
Matrix[5][0] = 3
Matrix[5][1] = 4
Matrix[5][2] = 5
Matrix[5][3] = 6
Matrix[5][4] = 11
Matrix[5][5] = 10
#This section Loads into trial handler
print('Created trials')
trialsList = []
for trial in range(6):
thisTrial = {}
order = range(6)
random.shuffle(order)
if 1:
= "deceptive trial"
else
=truthful trial
for i in range(6):
id = Matrix[trial][order[i]]
if(id ==1):
image = 'Face.1.jpg'
elif(id == 2):
image = 'Face.2.jpg'
elif(id == 3):
image = 'Face.3.jpg'
elif(id == 4):
image = 'Face.4.jpg'
elif(id == 5):
image = 'Face.5.jpg'
elif(id == 6):
image = 'Face.6.jpg'
elif(id == 7):
image = 'Face.7.jpg'
elif(id == 8):
image = 'Face.8.jpg'
elif(id == 9):
image = 'Face.9.jpg'
elif(id == 10):
image = 'Face.10.jpg'
elif(id == 11):
image = 'Face.11.jpg'
elif(id == 12):
image = 'Face.12.jpg'
else:
image = id
thisTrial[i] = image
trialsList.append(thisTrial)
print('SavedTrials')
#These positions have to be altered in order to accomodate for the images
positions = [
(-10, 10),
(10, 10),
(-10, -10),
(10, -10),
(-1, -10),
(0, 10),
]
#This section creates the objects we need for the experiment
trials = data.TrialHandler(trialList=trialsList, nReps=1,
method='random',
extraInfo=expInfo, name='trials')
thisExp.addLoop(trials)
#create a window
mywin = visual.Window([1920,1080], monitor="testMonitor", units="deg")
mywin.update()
img1 = visual.ImageStim(mywin, size=[5, 5])
Target = visual.ImageStim(mywin, size=[5, 5])
fixation = visual.GratingStim(mywin, tex=None, mask='raisedCos', size=20, units='pix')
responseClock = core.Clock()
message1 = visual.TextStim(mywin, text = "Are any of these people in the incident?")
message1.draw()
mywin.update()
response = event.waitKeys(keyList = ['space',], timeStamped = True)#this will wait for a button press confirmation from p's to continue
#Running the trials
for trial in trials:
for i in range(6):
# Prepare stimulus
#fixation.draw()
# Show it
if 1:
="Deceptive trial"
elif 2:
="Truthful trial"
Target.pos = positions[i]
Target.image = trial[i]
Target.draw()
mywin.flip()
responseClock.reset()
resp = event.waitKeys()
if resp == ["escape"]:
core.quit()
trials.addData('respDetect.keys', resp)
trials.addData('respDetect.rt', responseClock.getTime())
mywin.flip()
thisExp.nextEntry()
I have (surprisingly!) been getting this error message for line 90- "SyntaxError: invalid syntax"
.
Any help would be hugely welcomed.
Nathan