Good afternoon,
In my experiment, I first need to run a training session (with 24 trials) and then 3 sessions (with 96 trials each). I don’t know how to stop on the 24th and on the 96th trials. I think there is something to do with the trial parameters (because there are many TARLOCS and tarstim, maybe? )
Could someone, please, help me?
Thanks so much,
from psychopy.visual import Window, ImageStim, TextStim
from psychopy.core import wait, quit, logging
from psychopy import gui, visual, core, data, event, logging, clock
from psychopy.event import waitKeys, getKeys
import random
from PIL import Image, ImageDraw
# Create a window
disp = Window (size = (1440, 900), units="pix", fullscr=True)
#Cue locations
CUELOCS = ["upper","lower"]
#Target locations
TARLOCS = ["upcongLeft", "upcongRight","downcongRight"]
#Potential targets
TARGETS = ["left", "right"]
#Potential SOAs
SOAS = [0.093, 0.893]
#Fixation time at the start of a trial
FIXTIME = 1.6
#Duration of the cue Screen
CUETIME = 0.1
#Duration of the feedback Screen
FEEDBACKTIME = 1
# number of times to repeat training mode
TRAININGREPEATS = 1
# All possible cues
cuestim = {}
cuestim["upper"] = ImageStim(disp, size=(300,300), image="upper.png")
cuestim["lower"] = ImageStim(disp, size=(300,300), image="lower.png")
#All possible target stimulli
tarstim = {}
tarstim ["upcongLeft"]= ImageStim(disp, size=(300,300), image="upcongLeft.png")
tarstim["upcongLeft"].correctAns = 'left'
tarstim ["upcongRight"]= ImageStim(disp, size=(300,300), image="upcongRight.png")
tarstim["upcongRight"].correctAns = 'right'
tarstim ["downcongRight"]= ImageStim(disp, size=(300,300), image="downcongRight.png")
tarstim["downcongright"].correctAns = 'right'
# Create an empty list to contain the training trial
training = []
# LOOP
for cueside in CUELOCS:
for tarside in TARLOCS:
for soa in SOAS:
for tar in TARGETS:
# Training dictionary
trialtraining = {"cueside":cueside, "tarside":tarside, "target":tar, "soa":soa}
# add the trial dictionary to the list
training.extend (TRAININGREPEATS * [trialtraining])
# Randomise
random.shuffle (training)
…