<html><head></head><body bgcolor="#FFFFFF"><div>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. </div><div><br>Sent from John ZuHone's iPhone</div><div><br>On Apr 15, 2012, at 10:40 AM, Christopher Moody <<a href="mailto:cemoody@ucsc.edu">cemoody@ucsc.edu</a>> wrote:<br><br></div><div><span></span></div><blockquote type="cite"><div>Hi everyone,<div>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:</div>
<div><br></div><div><font face="'courier new', monospace">#find particles inside cell</font></div><div><font face="'courier new', monospace">idx = na.logical_and(na.all(le < pos,axis=1), na.all(re > pos,axis=1))</font></div>
<div><font face="'courier new', monospace">#assign them to a grid</font></div><div><font face="'courier new', monospace">...</font></div><div><font face="'courier new', monospace">#remove particles from future searches</font></div>
<div><font face="'courier new', monospace">pos = pos[~idx]</font></div><div><br></div><div>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? </div>
<div><br></div><div>Thanks ahead of time!</div><div>chris</div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>yt-dev mailing list</span><br><span><a href="mailto:yt-dev@lists.spacepope.org">yt-dev@lists.spacepope.org</a></span><br><span><a href="http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org">http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org</a></span><br></div></blockquote></body></html>