I don't have anything better at the moment, but there's a fast algorithm in FLASH for doing this that could be ported over and made part of yt that would probably be pretty useful.
Sent from John ZuHone's iPhone
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!