OS : Win10
PsychoPy version (e.g. 1.84.x): 2022.1.4
What are you trying to achieve?:
My experiment is fully built and functional, I am now optimising the output format on the .csv file. As a memory experiment, there is an encoding phase and I want to measure the time it takes the participant from the moment the stimulus appears in his eyes to the moment they click the button to move to the next word to be encoded (easy with the variable t)
Then i also want to know the total time he takes to learn all these words (so the sum of the values in this column) :
EncodRT = t
thisExp.addData('EncodRT', EncodRT)
I know I can easily calculate this with excel directly afterwards, but if i can sum that column, there is also three other variables that I need to sum at the end of the experiment
I don’t know much about coding, so i don’t really know what can i do here…
Hello,
take a look here Builder - providing feedback — Workshops for PsychoPy 2022 2022
It shows how to provide feedback after a block which you could adapt to your needs.
Best wishes Jens
Hello Jens,
Thanks for the answer, I tried to apply the trials.data[''].sum()
to my experience:
# End of the Encoding Task/Routine
RT = t
thisExp.addData('reactiontime', RT)
Ttotal = trialsEncod.data['reactiontime'].sum()
thisExp.addData('Ttotal', Ttotal)
Running the program, here is the error:
File "D:\Desktop\PsychoPy\ManipV1_lastrun.py", line 1709, in <module>
Ttotal = trialsEncod.data['reactiontime'].sum()
KeyError: 'reactiontime'
I probably didn’t understand the principle of the trials.data[''].sum()
, but I have to admit that I don’t know how to do the rest…
Hello Paulochon
do I understood you correctly that you want the sum of all RTs in column of your result file? If so, assuming that your trials-loop is called trials and your response-component is called key_resp, then add a routine following your trials-loop, insert a code-component in a routine and add the following code in the begin routine tab:
msgSum = trials.data['key_resp.rt'].sum()
thisExp.addData('sumRT', msgSum)
initialize msgSum in begin experiment tab:
msgSum = 0
See attached file for a toy-implementation
FeedbackBlock.psyexp (12.2 KB)
Best wishes Jens