When the line self["particle_velocity_x"] is called in HaloFinding.py, does it automatically give the number in CGS units already or is it in code units? It's used in calculating the rms velocity for each of the dark matter haloes, but it's subtracting centers and multiplying other values in code units I believe, just want to make sure the calculations are done in the same units.
From G.S.
Hi Geoffrey,
Here's the code for calculating RMS:
def rms_velocity(self):
"""
Returns the mass-weighted RMS velocity for the halo
particles in code units.
"""
bv = self.bulk_velocity()
pm = self["ParticleMassMsun"]
sm = pm.sum()
vx = (self["particle_velocity_x"] - bv[0]) * pm/sm
vy = (self["particle_velocity_y"] - bv[1]) * pm/sm
vz = (self["particle_velocity_z"] - bv[2]) * pm/sm
s = vx**2. + vy**2. + vz**2.
ms = na.mean(s)
return na.sqrt(ms) * pm.size
particle_velocity_[xyz] is returned in cgs (I just checked.) Bulk velocity is also cgs, and ParticleMassMsun is the weighting factor, so it doesn't need to be in any units. Looking at this code, it could be substantially more memory efficient, but as-is it should be correct and returning in cgs. Why do you think it might be wrong? Did you get bizarre answers?
-Matt
On Wed, Mar 10, 2010 at 6:32 PM, gso@physics.ucsd.edu wrote:
When the line self["particle_velocity_x"] is called in HaloFinding.py, does it automatically give the number in CGS units already or is it in code units? It's used in calculating the rms velocity for each of the dark matter haloes, but it's subtracting centers and multiplying other values in code units I believe, just want to make sure the calculations are done in the same units.
From G.S.
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Yeah I was just confused by the comment
"""
Returns the mass-weighted RMS velocity for the halo
particles in code units.
"""
because I got values and thought it was in code units so multiplying by the velocity conversion factor gave speeds exceeding c by orders of magnitude. So it is indeed already in CGS then.
From G.S.
Hi Geoffrey,
Here's the code for calculating RMS:
def rms_velocity(self):
"""
Returns the mass-weighted RMS velocity for the halo
particles in code units.
"""
bv = self.bulk_velocity()
pm = self["ParticleMassMsun"]
sm = pm.sum()
vx = (self["particle_velocity_x"] - bv[0]) * pm/sm
vy = (self["particle_velocity_y"] - bv[1]) * pm/sm
vz = (self["particle_velocity_z"] - bv[2]) * pm/sm
s = vx**2. + vy**2. + vz**2.
ms = na.mean(s)
return na.sqrt(ms) * pm.size
particle_velocity_[xyz] is returned in cgs (I just checked.) Bulk velocity is also cgs, and ParticleMassMsun is the weighting factor, so it doesn't need to be in any units. Looking at this code, it could be substantially more memory efficient, but as-is it should be correct and returning in cgs. Why do you think it might be wrong? Did you get bizarre answers?
-Matt
On Wed, Mar 10, 2010 at 6:32 PM, gso@physics.ucsd.edu wrote:
When the line self["particle_velocity_x"] is called in HaloFinding.py, does it automatically give the number in CGS units already or is it in code units? It's used in calculating the rms velocity for each of the dark matter haloes, but it's subtracting centers and multiplying other values in code units I believe, just want to make sure the calculations are done in the same units.
From G.S.
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Yeah I was just confused by the comment
"""
Returns the mass-weighted RMS velocity for the halo
particles in code units.
"""
As the author of that comment, I am guilty of being confused! But thanks for asking the question and forcing us to get our facts straight. I'll fix the comment soon.
sskory@physics.ucsd.edu o__ Stephen Skory http://physics.ucsd.edu/~sskory/ _.>/ _Graduate Student ________________________________(_)_\(_)_______________