G.S.,<br><br>I would recommend using the WeightedAverageQuantity derived quantity to calculate field averages.  If you are doing unigrids, what you've done is ok, but if you're using AMR, an unweighted average like what you've done is a little improper, since the cells have different sizes.  In a unigrid, an unweighted average is the same as weighting by CellVolume, so if that's really what you're looking for, you could use the derived quantity above with CellVolume as the weight field.  This may also solve your precision problem.  However, you may want to think about other weighting methods in the future if you do this for AMR.<br>
<br>Britton<br><br><div class="gmail_quote">On Fri, Jun 18, 2010 at 1:19 PM,  <span dir="ltr"><<a href="mailto:gso@physics.ucsd.edu">gso@physics.ucsd.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
My script below gives the max min and mean of a field, however, the mean<br>
seems to be only giving me 6 digits of accuracy as seen in the output:<br>
<br>
min 5.3512599744055807e-30<br>
max 2.4254363112272260e-26<br>
mean 7.9708800000000001e-29<br>
<br>
it's very unlikely that the mean value has all those zeroes in it, is<br>
there a quick way to get higher accuracy using something similar to<br>
dd.quantites[] or do I have to calculate the total by looping over all the<br>
cells to get the higher precision I needed?<br>
<br>
From<br>
G.S.<br>
<br>
from yt.mods import *<br>
pf = EnzoStaticOutput("DD0273/DD0273")<br>
res=64<br>
#v,c = pf.h.find_min("Density")<br>
#print v,c<br>
dd = pf.h.all_data()<br>
field = "Density"<br>
extreme = dd.quantities["Extrema"](field)[0]<br>
zmin = extreme[0]<br>
zmax = extreme[1]<br>
mean = dd.quantities["TotalQuantity"](field)[0]/res**3<br>
print ("min %16.16e" % zmin)<br>
print ("max %16.16e" % zmax)<br>
print ("mean %16.16e" % mean)<br>
<br>
_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
</blockquote></div><br>