Calculating specific accuracy with decimals
Hi everyone,
I am building a Go-NoGo experiment and I want to show two types of accuracy feedback after each block:
1. the usual [acc] % for all sorts of responses. This works just fine and is displayed with two decimals (e.g. 83,33333 = 83,33%)
2. I want to give feedback about the accuracy only on NoGo-trials. The problem is that the result of my equation is always displayed without decimals (e.g. 73,33333 = 73%). I assume that the automatic variable type has something to do with it. Is there any possibility that the NoGo_acc is also shown with two decimals?
I calculate it in a python inline_script with this equation:
var.NoGo_acc = var.NoGo_corectr*100/var.NoGo_total
Thanks for your help!
Comments
Dear Bird
i had the same problem just yesterday!
solved it this way:
format(var.yourRT/1000, '.2f') + ' sec'There you go.
Greetz
Stephan
Just noticed it myself. You'll always get x.00 sec with that.
Solution:
format(var.yourRT/float(1000), '.2f') + ' sec'Now it works, i think.
Thanks Dahm.
Actually I solved the problem just minutes after my post - how embarrassing. The only thing I needed to do was to put
float (var.name)
in front of the variables.