<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Sam,<div><br></div><div>That's clever :)  Thanks for the tip.  I'll try this method out.</div><div><br></div><div>John</div><div><br><div><div>On 26 Aug 2010, at 10:27, Sam Skillman wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi John,<div><br></div><div>I think you could also do something similar with a 1D profile, though it isn't quite as easy to dial in an exact limit:</div><div><br></div><div><a href="http://yt.enzotools.org/doc/api/generated/plot_types/yt.raven.PlotCollection.add_profile_object.html?highlight=add_profile#yt-raven-plotcollection-add-profile-object">http://yt.enzotools.org/doc/api/generated/plot_types/yt.raven.PlotCollection.add_profile_object.html?highlight=add_profile#yt-raven-plotcollection-add-profile-object</a></div>

<div><br></div><div>where you define the whole box as the region you care about and then do:</div><div># Get the whole box</div><div>reg = pf.h.all_data()</div><div><br></div><div># Make the profile</div><div>metal_mass = pc.add_profile_object(reg, ["Metallicity", "CellMass"])</div>

<div><br></div><div># Get some easy pointers to the profile data</div><div>bins = metal_mass.data._bins</div><div>mass = metal_mass.data["CellMass"]<br></div><div><br></div><div>#  Now get total mass with Metallicity above a 1.0e-4 by getting the number of </div>

<div><div>mass_frac = mass[bins>1.0e-4].sum()/mass.sum()</div></div><div><br></div><div>That should give you something close to what you'd want.  You may want to increase the number of xbins if you want higher accuracy answer.  Finally, I'll just make a quick note that the profile creation can be done in parallel as long as lazy_reader=True, which it is by default.  </div>

<div><br></div><div>There may be other ways to do this as well, but this is what I'd probably do.</div><div><br></div><div>Best,</div><div>Sam</div><div><br><div class="gmail_quote">On Thu, Aug 26, 2010 at 7:00 AM, John Wise <span dir="ltr"><<a href="mailto:jwise@astro.princeton.edu">jwise@astro.princeton.edu</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi,<br>
<br>
I wanted to calculate volume filling fractions and mass fractions of gas that met some criteria.  Specifically, the fractions that have a certain metallicity.  The _Action routine looked promising, but I couldn't figure out how to use it.  I remember there was some talk about filters on the list, but I searched and found that it concerned the halo finder.<br>


<br>
I might have reinvented the wheel, but this is how I did it.<br>
<br>
<a href="http://paste.enzotools.org/show/1125/" target="_blank">http://paste.enzotools.org/show/1125/</a><br>
<br>
It's basically _TotalQuantity with a filter.  Also I wanted it to accept multiple limits to avoid re-reading the data for every filter.<br>
<br>
Was there an easier way to do this?<br>
<br>
Thanks,<br>
John<br>
_______________________________________________<br>
Yt-dev mailing list<br>
<a href="mailto:Yt-dev@lists.spacepope.org">Yt-dev@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Samuel W. Skillman<br>DOE Computational Science Graduate Fellow<br>Center for Astrophysics and Space Astronomy<br>University of Colorado at Boulder<br>samuel.skillman[at]<a href="http://colorado.edu/">colorado.edu</a><br>


</div>
_______________________________________________<br>Yt-dev mailing list<br><a href="mailto:Yt-dev@lists.spacepope.org">Yt-dev@lists.spacepope.org</a><br>http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org<br></blockquote></div><br></div></body></html>