[yt-users] simple calculation question

Robert Thompson rthompsonj at gmail.com
Thu Aug 12 12:42:55 PDT 2010


Hi yt users,

I'm still very new at python syntax so please forgive me =)

I've ran a few n-body simulations and I'd like to simply calculate the
pairwise velocity between the halo pairs.  I simply need to read in the
x,y,z positions & vx,vy,vz velocities from the halo finder output, do some
calculations, and output the result.  I've done this in C but I'd love to
learn how to do this in yt.  Here's my calculation in C:

  for(i=0; i<NUM; i++)
    {

    for(j=i+1; j<NUM; j++)
        {
          dXctr = periodic(Xctr[i] - Xctr[j]) / 1000.; /* in Mpc/h */
          dYctr = periodic(Yctr[i] - Yctr[j]) / 1000.;
          dZctr = periodic(Zctr[i] - Zctr[j]) / 1000.;

          d = sqrt(dXctr*dXctr + dYctr*dYctr + dZctr*dZctr); /* in Mpc/h */

          if(d < 10.)  /* less than 10 Mpc/h */
            {
              dvx = vx[i] - vx[j];
              dvy = vy[i] - vy[j];
              dvz = vz[i] - vz[j];

              vrel = sqrt(dvx*dvx + dvy*dvy + dvz*dvz);
            }
        }

How would I go about doing this in yt given the halo finder outputs.  Thanks
for the assistance!

-Robert Thompson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20100812/841cceeb/attachment.htm>


More information about the yt-users mailing list