[yt-users] units

Matthew Turk matthewturk at gmail.com
Wed Mar 10 20:44:21 PST 2010


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 at 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 at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>



More information about the yt-users mailing list