Hi,
This code uses all the previus responses to do a final feedback. The message appears properly on Psychopy, but on Pavlovia appear just “doh!” and not the right message (msg) that I really want.
To build this code, I’ve just copy from others experiments, so I don’t understend it very well, but it is working on Pshophy… What could I do to fix this on Pavlovia?
Thank you
In general, plus concatenation is smoother to translate to JS over formatted strings. and using the methods sum and average in this new way translate smoother than calling the method on the object as you have done (and as would be normal in python)
Great.
This will be very helpful.
Here is the full text of the code:
nCorr = study.data['totalacertos'].sum() #.std(), .mean() also available
meanRt = study.data['key_resp_2.rt'].mean()
msg = "Você acertou %i operações de 192, com tempo de reação médio de %.2f segundos. Pressione [→] para continuar." %(ei,ui/192)
It is in portuguese (Brazil) and says that:
-You hit %i operations out of 192, with an average reaction time of %.2f seconds. Press [→] to continue." %(ei,ui/192)
[totalacertos] is the sum of a colum in the output witch all the right answers will be iqual to 1. So I have to divide this sum for 192 (total of tasks) and after show the mean of reaction time.
Now I have to write:
nCorr = sum(study.data['totalacertos'])
meanRT = average(study.data['key_resp_2.rt')
msg = 'Voce acertou' + str(nCorr) + 'operacoes de 192, with an average reaction time of' + str(meanRT) [?]
I believe they worked. The only problem is that after the correction the variable [totalacertos] is not being recognized and this generates an error. Even though the variable is being created in the output, Pavlovia is not recognizing it. Any idea what I should change?
I think the issue is that study.data is undefined. If you comment out line 1 of Begin Routine, you’ll probably get an error message related to line 2 instead.
I’m not sure about the automatic creation of results dictionaries. Does this code work offline?
I had to change part of the code. Pavlovia reads JAVA and for this I had to change de way to add data. First I used study.addData(‘totalacertos’, Acerto) and it runs on Psychopy, affter I changed to thisExp.addData(‘totalacertors’, Acerto) to run on Pavlovia and to have this data on the output.
So, Have I to change the name study.Data to thisExp.Data? Or is there another way to this data be recognized on Pavlovia?
My idea is add a colum on the output (called [totalacertos]) and in each correct answer will appear the number “1” to be summed and showed all the correct answers on the last feedback of the experiment [Feedback_Fim].
I am trying to follow the original experiment. They aks to answer some tasks with a feedback, then give a pause, and repeat this oder times, then give a final feedback with the number of correct answers and the reaction time.
To the best of my knowledge loops don’t have a data method so you can’t access data from a loop by using study.data[‘varname’]. I’d be interested to find out where you got this suggestion from.
What I do is, for example, append to a custom list of scores or reaction times and then calculate the sum, mean or median of that list.
Dear Becca and Wakecarter, thank you for your feedback. I am working with gustavo in this specific experiment. I honestly dont remember where we got the orientation for getting data from the loop using the study.data[‘varname’], but it did work when running the task in psychopy. But when we moved to pavlovia we didnt get the right feedback (sum of hits and average of reaction times) anymore. It probably is a thing with this unconventional strategy. What would you recommend us to do? I am not very experienced with psychopy so I didnt understand very well the suggestion to “append to a custom list of scores or reaction times and then calculate the sum, mean…”.