Let’s try and create a ‘Feedback’ Routine for the Posner task we want to:
To add trial by trial feedback on response times create a feedback routine and add a text component. In the text field enter:
$f'RT was {str(round(resp.time[0], 3))} ms'
To adjust feedback colour based on response time we need a code component:
if resp.time[0]<.5:
feedbackCol = 'green'
else:
feedbackCol = 'red'
To give feedback at the end for each condition let’s learn about lists. We want three lists to keep track of RTs:
allRTList=[]
validRTList=[]
invalidRTList=[]
Some useful Python methods
We can use these to give feedback at the end of our experiment to summarise performance.
On each trial we add to the list:
if label == 'valid':
validRTList.append(thisRT)
elif label == 'invalid':
invalidRTList.append(thisRT)
At the end of the experiment we can average these lists:
validAv = np.average(validRTList)
Code components allow us to extend mouse responses in some fun ways. So let’s talk about Making the most of mouse inputs.