[yt-users] Particle Positions

Stephen Skory s at skory.us
Sat Jun 25 10:52:27 PDT 2011


Hi Brian,

> I'm trying to find the initial (DD0000) locations of a collection particles that form a halo at a later time.  I have a list of particle IDs from that halo that I want to find the x, y, and z positions for, but I can't seem to figure out how to do for just these particles and not all the particles in the simulation.  Does anyone have a suggestion on how to do this?  I've been trying to use pf.h.all_data() but am stuck on getting it to only return data for this certain list of particles.

I've done this kind of thing before, and what you'll want to use is numpy.in1d:

http://docs.scipy.org/doc/numpy/reference/generated/numpy.in1d.html

A brief overview is to get the indices of the particles you want at
the late redshift into an array (say, late_ids), then get all the
indices of the DD0000 particles (in all_early_ids). You can then use
the boolean array that in1d returns to pull out only the values from
the position arrays for the particles that you want.

Let me know if you don't understand!

p.s. you can set assume_unique=True in in1d, if you like!


-- 
Stephen Skory
s at skory.us
http://stephenskory.com/
510.621.3687 (google voice)



More information about the yt-users mailing list