[yt-users] Particle Positions
Brian Crosby
crosby.bd at gmail.com
Sat Jun 25 11:19:23 PDT 2011
Thanks Stephen, that worked like charm!
-Brian
On Jun 25, 2011, at 1:52 PM, Stephen Skory wrote:
> 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)
> _______________________________________________
> 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