Hi all,
So with this code, I have included the block of code which is causing issues, within the four of the experiment. What I wish to achieve is for this block, like the three other blocks, to appear with 12 trials broken down into two conditions of 6. So 6 amounts (e.g. 10,000) appear, then a message appears saying ‘deception’ then another 6 appear.
However, the issue I am having is that the “Amounts” block is not presenting sequentially, i.e. the six stimuli are not being presented one after another. Instead, it is presenting the six amounts in a continous, endless cycle, i.e. 6 then 6 then 6, but not for 12 trials, but forever. You’ll notice that the code is indented strangely-I am using an eye tracker in addition to the code itself- I think the indenting may be causing the problem somewhere-perhaps in some additive fashion…
######Amount block#######
message6 = visual.TextStim(win, text = "Are any of these amounts involved in the incident?")
message6.draw()
win.update()
response = event.waitKeys(keyList = ['space',], timeStamped = True)#this will wait for a button press confirmation from p's to continue
#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
#Thise section Loads into trial handler
print('Created trials')
trialsList = []
for trial in range(6):
thisTrial = {}
order = range(6)
random.shuffle(order)
for i in range(6):
id = Matrix[trial][order[i]]
if(id ==1):
text = '10,000'
elif(id == 2):
text = '50,000'
elif(id == 3):
text = '100,000'
elif(id == 4):
text = '200,000'
elif(id == 5):
text = '45,000'
elif(id == 6):
text = '75,000'
elif(id == 7):
text = '250,000'
elif(id == 8):
text = '300,000'
elif(id == 9):
text = '400,000'
elif(id == 10):
text = '450,000'
elif(id == 11):
text = '500,000'
elif(id == 12):
text = '550,000'
else:
text = id
thisTrial[i] = text
trialsList.append(thisTrial)
print('SavedTrials')
trials = data.TrialHandler(trialList=trialsList, nReps=1,
method='random',
extraInfo=expInfo, name='trials')
thisExp.addLoop(trials)
#create a window
message4 = visual.TextStim(win, text = "Truthful")
message4.draw()
win.update()
core.wait(2)
Target = visual.TextStim(win, text = "text default")
responseClock = core.Clock()
#Loop for carrying out the trials THIS LOOP IS REPEATING FOREVER
for trial in trials:
fixation.draw()
win.flip()
core.wait(1)
for i in range(6):
# Prepare stimulus
#fixation.draw()
# Show it
Target.pos = positions[i]
Target.text = trial[i]
Target.draw()
win.flip()
responseClock.reset()
boop = 0
while boop == 0:
resp = event.waitKeys()
if resp == ["escape"]:
core.quit()
if resp == ["p"]:
boop = 1
if resp == ["q"]:
boop = 1
trials.addData('respDetect.keys', resp)
trials.addData('respDetect.rt', responseClock.getTime())
trials.addData('Trial Type', 'Truthful')
mywin.flip()
trials = data.TrialHandler(trialList=trialsList, nReps=1,
method='random',
extraInfo=expInfo, name='trials')
thisExp.addLoop(trials)
#Its never getting here
message14 = visual.TextStim(win, text = "Deception")
message14.draw()
win.update()
core.wait(2)
#Loop for carrying out the trials
for trial in trials:
fixation.draw()
win.flip()
core.wait(1)
for i in range(6):
# Prepare stimulus
#fixation.draw()
# Show it
Target.pos = positions[i]
Target.text = trial[i]
Target.draw()
win.flip()
responseClock.reset()
boop = 0
while boop == 0:
resp = event.waitKeys()
if resp == ["escape"]:
core.quit()
if resp == ["p"]:
boop = 1
if resp == ["q"]:
boop = 1
trials.addData('respDetect.keys', resp)
trials.addData('respDetect.rt', responseClock.getTime())
trials.addData('Trial Type', 'Deception')
mywin.flip()
thisExp.nextEntry()
```
Any help would be gratefully recieved.
Nathan