Hi,
I’m trying to create an experiment where on the 5th trial I can show a different trial. to be more specific i want to show some images 5 times, then i want to show pairs of those images previously shown each fifth image… The images are in an excel file, and the pairs of images are on another excel file. I don’t combine them, because I previously randomized the images and the order of the pairs.
I have two questions: is it possible to use something similar as in R, to call a condition (excel file) within a trial loop without using another loop? if so how can i use it?
for example i have:
conditions = data.importConditions(images.csv)
conditions2 = data.importConditions(pairsof images.csv)
nReps = 1
trials1 = data.TrialHandler(conditions, nReps, method = "sequential")
pics = visual.ImageStim(win)
words = visual.TextStim(win)
trials2 = data.TrialHandler(conditions2, nReps, method = "sequential")
pic1 = visual.ImageStim(win)
pic2 = visual.ImageStim(win)
for trial in trials1:
etc..
Can i do something like:
“from conditions2” pic1.draw()?
If the above is not possible, I used a for loop with the trials2 in order to use pic1 and pic2, I have to stop the trial otherwise it will show all the pairs without waiting for the next 5th trial.
for that I used trials2.finish= True, and then I say it’s false in order to resume the trials when the condition of the trials being the 5th to show the pairs… The problem is that instead of showing or “resuming” in the second trial (second pair of images), it skips that one and starts with the third pair… I tried using getEarliertrial, but it didn’t work, is there any other solution?
that part of the code looks like this right now.
for trial in trialspav: # this is the first condition
if trial["Trialnr"] in list:
trialsquery.finished = False # somehow when I "resume" it skips one row on the excel file
for n,i in enumerate(list):
if i %5 ==0:
list[n] = i + 5
for trials in trialsquery: #this is my second condition
print trialsquery.thisIndex #i used this to check what happened and it goes from 0 to 2 to 4... skipink 1 and 3... and so forth
if trialsquery.thisIndex != 0 and trialsquery.thisIndex %2 == 0:
#trialsquery.getEarlierTrial(n = -1) #I tried this but it doesn't work
#trialsquery.getFutureTrial(1)
pic1.setImage(trials["Image3"]) #he encounter a pair of stimuli
pic1.pos = (-.5,0)
pic2.setImage(trials["Image2"])
pic2.pos = (.5,0)
query = mouse_choice (win, True, pic1, pic2) #the person just chooses the highest value, to reinforce learning
if query < 0:
query = trial["Value"] #because we don't know the order beforehand
trialsquery.finished = True
else:
query = trial["Value"]
trialsquery.finished= True
win.flip()
else:
#trialsquery.getEarlierTrial(n = -1) # itried also here, didn't work
pic1.setImage(trials["Image3"]) #he encounter a pair of stimuli
pic1.pos = (-.5,0)
pic2.setImage(trials["Image2"])
pic2.pos = (.5,0)
query = mouse_choice (win, True, pic1, pic2) #the person just chooses the highest value, to reinforce learning
if query < 0:
query = trial["Value"] #because we don't know the order beforehand
trialsquery.finished = True
else:
query = trial["Value"]
trialsquery.finished= True
win.flip()
I appreciate any suggestions or comments to “fix this”
Thank you in advance.