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) * pm/sm vy = (self["particle_velocity_y"] - bv) * pm/sm vz = (self["particle_velocity_z"] - bv) * 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?
On Wed, Mar 10, 2010 at 6:32 PM, email@example.com 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.
yt-users mailing list firstname.lastname@example.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org