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.
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).
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
On Mon, Nov 30, 2009 at 11:07 AM, Agarwal, Shankar <sagarwal(a)ku.edu> wrote:
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.
Here I am comparing HaolProfiler to itself. Let me know if my question is
From: yt-users-bounces(a)lists.spacepope.org on behalf of Matthew Turk
Sent: Mon 11/30/2009 11:54 AM
To: Discussion of the yt analysis package
Subject: Re: [yt-users] HaloProfiler vs sum_mass_in_sphere.py
You wrote to the list a week ago asking an almost identical question:
and Stephen answered you:
The same answer applies here.
On Mon, Nov 30, 2009 at 9:48 AM, Agarwal, Shankar <sagarwal(a)ku.edu> wrote:
> Hi, I ran HaloProfiler on HaloAnalysis.out and here is the data for the
> # id center center center RadiusMpc
> 0000 0.169329105 0.144388856 0.8246570556 3.1986507886
> Then I ran sum_mass_in_sphere.py with the above center and radius ...
> from yt.mods import *
> fn = "RedshiftOutput0002"
> pf = load(fn)
> sp =
> baryon_mass, particle_mass = sp.quantities["TotalQuantity"](
> ["CellMassMsun", "ParticleMassMsun"], lazy_reader=True)
> print "Total mass in sphere is %0.5e (gas = %0.5e / particles = %0.5e)" %
> (baryon_mass + particle_mass, baryon_mass, particle_mass)
> And got...
> Total mass in sphere is 1.27226e+15 (gas = 2.06890e+14 / particles =
> Let me know if the TotalMassMsun should match. Because they don't.
> KU Cosmology
> yt-users mailing list
yt-users mailing list
yt-users mailing list