Britton ported CIC routines to yt a while back. They might work for what you're looking at; you can see them used to deposit particles in the universal fields, and the source is in the CIC Cython routine.
On Sun, Apr 15, 2012 at 1:40 PM, Christopher Moody email@example.com wrote:
Hi everyone, I just asked the IRC list this, but I guess no one was there. I'm trying to grid a few million particles onto the yt grids, but checking if the left and right edges of my particles are inside every cell is slow:
# find particles inside cell
idx = na.logical_and(na.all(le < pos,axis=1), na.all(re > pos,axis=1))
# assign them to a grid
# remove particles from future searches
pos = pos[~idx]
I start with the finest grids at the highest levels, and once the particles are gridded they're removed -- so the list of particles is always decreasing, and the coarsest mesh tends to have only a few particles. I'm guessing that somewhere this has been done before - I'd rather not reinvent the wheel. Has anyone used any relevant kdtree (or cython) code in the yt utilities that can select a subvolume of particles quickly?
Thanks ahead of time! chris
yt-dev mailing list firstname.lastname@example.org http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org