<div dir="ltr">Thanks. I'll get the "bleeding edge" version first then try your suggestions. Though I want to return the NxNxN array and be able to write this mesh to a file. It is *only* using the cic part of yt and it should return the mesh to be written? Just wanted to clarify?<div>
<br></div><div>Thanks.<br><div>Brendan</div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jun 5, 2014 at 6:49 PM, Nathan Goldbaum <span dir="ltr"><<a href="mailto:nathan12343@gmail.com" target="_blank">nathan12343@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote"><div class="">On Thu, Jun 5, 2014 at 3:36 PM, John ZuHone <span dir="ltr"><<a href="mailto:jzuhone@gmail.com" target="_blank">jzuhone@gmail.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi Brendan,<br>
<br>
Which version of yt are you using?<br>
<br>
If you're using 3.0, this is actually fairly easy. If you look in <a href="http://yt.fields.particle_fields.py" target="_blank">yt.fields.particle_fields.py</a>, around line 85, you can see how this is done for the "particle_density" and "particle_mass" fields. Basically you can call a "deposit" method which takes the particle field quantity you want deposited and deposits it into cells. The underlying calculation is done using Cython, so it's fast.<br>


</blockquote><div><br></div></div><div>And you shouldn't ever actually need to call these "deposit" functions, since "deposit" is exposed as a field type for all datasets that contain particles.</div>
<div>

<br></div><div>Here is a notebook that does this for Enzo AMR data:</div><div><br></div><div><a href="http://nbviewer.ipython.org/gist/ngoldbaum/5e19e4e6cc2bf330149c" target="_blank">http://nbviewer.ipython.org/gist/ngoldbaum/5e19e4e6cc2bf330149c</a><br>


</div><div><br></div><div>This dataset contains about a million particles and generates a CIC deposition for the whole domain in about 6 seconds from a cold start.</div><div class=""><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">



<br>
If you're using 2.x, then you can do the same thing, but it's not as straightforward. You can see how this works in <a href="http://yt.data_objects.universal_fields.py" target="_blank">yt.data_objects.universal_fields.py</a>, around line 986, where the "particle_density" field is defined. Basically, it calls CICDeposit_3, which is in yt.utilities.lib.CICDeposit.pyx.<br>



<br>
Let me know if you need any more clarification.<br>
<br>
Best,<br>
<br>
John Z<br>
<div><div><br>
On Jun 5, 2014, at 6:07 PM, Brendan Griffen <<a href="mailto:brendan.f.griffen@gmail.com" target="_blank">brendan.f.griffen@gmail.com</a>> wrote:<br>
<br>
> Hi,<br>
><br>
> I was wondering if there were any Cython routines within yt which takes particle data and converts it into a cloud-in-cell based mesh which can be written to a file of my choosing. </div></div></blockquote><div><br>


</div></div><div>What sort of mesh were you looking for?  yt will internally construct an octree if it is fed particle data.  I'm not sure whether this octree can be saved to disk for later analysis.  </div><div><br>
</div>
<div>
It's also possible to create a uniform resolution covering grid containing field data for a deposited quantity, which can be quite easily saved to disk in a number of ways.</div><div class=""><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


<div><div>I heard a while ago there was some such functionality but it could be too far down the yt rabbit hole to be used as a standalone? Is this true? I have my own Python code for doing it but it just isn't fast enough and thought I'd ask the yt community if there were any wrapper tools available to boost the speed.<br>



><br>
> Thanks.<br>
> Brendan<br>
</div></div>> _______________________________________________<br>
> yt-users mailing list<br>
> <a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
> <a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br>
_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
</blockquote></div></div><br></div></div>
<br>_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br></div>