I coded up the following series of commands, and for some reason the screen is not advancing past the picture and the rating scale. I am able to make a selection on the first picture, but the second image does not show up. I checked my “Pos_List” and it looks good. The output seems to code the same response form the rating scale on every single stimulus- so it seems to advance through all the stimuli very quickly.
Wondering if I am missing something obvious in this loop.
d = {'ID': [], 'Date': [], 'Time': [], 'Session': [], 'Trial_Number': [],'Stimulus': [],'Response_Type': [],'Reaction_Time': [], 'choiceHistory':[]}
# Create a list from Targets
Pos_List = []
for root, dirs, files in os.walk(Stim_Path):
for file in files:
if file.endswith('.jpg'):
Pos_List.append(Stim_Path + file)
# Shuffle the list
np.random.shuffle(Pos_List)
# Include Some Info about the experiment
d['ID'].append(('ID'))
d['Date'].append((time.strftime("%m/%d/%Y")))
d['Time'].append((time.strftime("%H:%M")))
d['Session'].append(('Encoding'))
ratingScale = visual.RatingScale(win, choices=['Old', 'New'], markerStart=0.5, acceptKeys='space', pos= (0.0, -0.46), disappear=True)
# Present the Pics and store responses
def Present_and_Record():
trial_count = 0
for stim in Pos_List:
Pic_to_Draw = visual.ImageStim(win, image=str(stim))
clock.reset()
while ratingScale.noResponse:
Pic_to_Draw.draw()
ratingScale.draw()
win.flip()
trial_count = trial_count + 1
Response = ratingScale.getRating()
decisionTime = ratingScale.getRT()
choiceHistory = ratingScale.getHistory()
d['Stimulus'].append((stim))
d['Response_Type'].append((Response))
d['Reaction_Time'].append((decisionTime))
d['choiceHistory'].append((choiceHistory))
# Record Responses
return(d)
d= Present_and_Record()
Note, I followed Example 1 pretty closely from this link:
https://www.psychopy.org/api/visual/ratingscale.html