[yt-users] precision of TotalQuantity

gso at physics.ucsd.edu gso at physics.ucsd.edu
Fri Jun 18 12:19:15 PDT 2010


My script below gives the max min and mean of a field, however, the mean
seems to be only giving me 6 digits of accuracy as seen in the output:

min 5.3512599744055807e-30
max 2.4254363112272260e-26
mean 7.9708800000000001e-29

it's very unlikely that the mean value has all those zeroes in it, is
there a quick way to get higher accuracy using something similar to
dd.quantites[] or do I have to calculate the total by looping over all the
cells to get the higher precision I needed?

From
G.S.

from yt.mods import *
pf = EnzoStaticOutput("DD0273/DD0273")
res=64
#v,c = pf.h.find_min("Density")
#print v,c
dd = pf.h.all_data()
field = "Density"
extreme = dd.quantities["Extrema"](field)[0]
zmin = extreme[0]
zmax = extreme[1]
mean = dd.quantities["TotalQuantity"](field)[0]/res**3
print ("min %16.16e" % zmin)
print ("max %16.16e" % zmax)
print ("mean %16.16e" % mean)




More information about the yt-users mailing list