Hi Shankar,<br><br>A few things come to mind here.  The TotalMassMsun field is defined as the sum of [(baryon) Density + Dark_Matter_Density] * CellVolume.  The Dark_Matter_Density field is a grid field that is interpolated from the particle data using the cloud-in-cell method.  The mass of each particle is smoothed over 2 cells in each direction, so 8 total 3D grid cells.  The ParticleMassMsun field, on the other hand, is not a grid field, but a particle field.  What this means is that when you sum ParticleMassMsun for some region, you are getting the sum of the mass of all the particles enclosed within that region.  When you sum TotalMassMsun, you are getting the sum of the mass within each cell enclosed within the region.<br>
<br>Another possibility is that the value of TotalMassMsun being output in the file you showed comes from interpolating a 1D radial profile of TotalMassMsun vs. Overdensity for the value of the critical overdensity that has been specified (default: 200).<br>
<br>Most likely, it's a combination of both of these, and the two values you're looking at will never be exactly the same.  My impression is that the effect will be greater if the sphere encompasses only a small number of cells, since a larger fraction of the particles may contribute mass to cells that are outside the sphere.  You should investigate this with spheres of different sizes.<br>
<br>Regards,<br>Britton<br><br><div class="gmail_quote">On Mon, Nov 30, 2009 at 11:07 AM, Agarwal, Shankar <span dir="ltr"><<a href="mailto:sagarwal@ku.edu">sagarwal@ku.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Matt,<br>
<br>
Actually, that earlier post was a different question. There I was comparing HopFinder and HaloFinder. Stephen clarified that for me that these two calculate mass differently.<br>
<br>
Here I am comparing HaolProfiler to itself. Let me know if my question is confusing.<br>
<font color="#888888"><br>
shankar<br>
</font><div><div></div><div class="h5"><br>
-----Original Message-----<br>
From: <a href="mailto:yt-users-bounces@lists.spacepope.org">yt-users-bounces@lists.spacepope.org</a> on behalf of Matthew Turk<br>
Sent: Mon 11/30/2009 11:54 AM<br>
To: Discussion of the yt analysis package<br>
Subject: Re: [yt-users] HaloProfiler vs sum_mass_in_sphere.py<br>
<br>
Hi Shankar,<br>
<br>
You wrote to the list a week ago asking an almost identical question:<br>
<br>
<a href="http://lists.spacepope.org/pipermail/yt-users-spacepope.org/2009-November/000252.html" target="_blank">http://lists.spacepope.org/pipermail/yt-users-spacepope.org/2009-November/000252.html</a><br>
<br>
and Stephen answered you:<br>
<br>
<a href="http://lists.spacepope.org/pipermail/yt-users-spacepope.org/2009-November/000253.html" target="_blank">http://lists.spacepope.org/pipermail/yt-users-spacepope.org/2009-November/000253.html</a><br>
<br>
The same answer applies here.<br>
<br>
-Matt<br>
<br>
On Mon, Nov 30, 2009 at 9:48 AM, Agarwal, Shankar <<a href="mailto:sagarwal@ku.edu">sagarwal@ku.edu</a>> wrote:<br>
> Hi, I ran HaloProfiler on HaloAnalysis.out and here is the data for the first halo...<br>
><br>
> # id    center[0]       center[1]       center[2]       RadiusMpc       TotalMassMsun<br>
> 0000    0.169329105     0.144388856     0.8246570556    3.1986507886    1.07530961369e+15<br>
><br>
><br>
><br>
><br>
> Then I ran sum_mass_in_sphere.py with the above center and radius ...<br>
><br>
> from yt.mods import *<br>
> fn = "RedshiftOutput0002"<br>
> pf = load(fn)<br>
> sp = pf.h.sphere([0.169329105,0.144388856,0.8246570556],3.1986507886/pf["mpc"])<br>
> baryon_mass, particle_mass = sp.quantities["TotalQuantity"](<br>
>        ["CellMassMsun", "ParticleMassMsun"], lazy_reader=True)<br>
> print "Total mass in sphere is %0.5e (gas = %0.5e / particles = %0.5e)" % \<br>
>            (baryon_mass + particle_mass, baryon_mass, particle_mass)<br>
><br>
><br>
> And got...<br>
><br>
> Total mass in sphere is 1.27226e+15 (gas = 2.06890e+14 / particles = 1.06537e+15)<br>
><br>
><br>
> Let me know if the TotalMassMsun should match. Because they don't.<br>
><br>
> regards<br>
> shankar<br>
> KU Cosmology<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>
><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>
<br>
</div></div><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>
<br></blockquote></div><br>