[yt-users] plotting average quantaties

Alexander Philippov philippo at astro.princeton.edu
Wed Oct 23 03:56:17 PDT 2013


Thanks all for very constructive suggestions! Matt and Jeff
thing works good.

Thanks,
Sasha



On Tue, Oct 22, 2013 at 5:45 AM, j s oishi <jsoishi at gmail.com> wrote:

> I think Sasha may want a simpler, unweighted average. You can do this by
> setting the weight field to Ones. If you set the weight to None, you'll get
> a sum across x.
> 
> You'll probably want to set n_bins to the number of x cells to get what
> you are looking for.
> 
> Hope this is helpful,
> 
> Jeff
> On Oct 22, 2013 8:25 AM, "Matthew Turk" <matthewturk at gmail.com> wrote:
> 
>> Hi Sasha,
>> 
>> I'm not sure I understand what you're looking for.  The functionality to
>> take averages of one field wrt another field might work for what you're
>> looking for, using the BinnedProfile1D object.  If so, you could bin by the
>> "x" field and then take a weighted average of Density.  This might look
>> something like this:
>> 
>> dd = pf.h.all_data()
>> prof = BinnedProfile1D(dd, n_bins, "x", pf.domain_left_edge[0],
>> pf.domain_right_edge[0], log_space = False)
>> prof.add_fields(["Density"], weight="CellMassMsun")
>> 
>> Does that help?
>> 
>> Best,
>> 
>> Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20131023/294b839f/attachment.html>


More information about the yt-users mailing list