<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Thanks all for very constructive suggestions! Matt and Jeff</div><div>thing works good.</div><div><br></div><div>Thanks,</div><div>Sasha</div><div><br></div><div><br></div><div><br></div><div>On Tue, Oct 22, 2013 at 5:45 AM, j s oishi <<a href="mailto:jsoishi@gmail.com">jsoishi@gmail.com</a>> wrote:<br><br><blockquote type="cite">I think Sasha may want a simpler, unweighted average. You can do this by<br></blockquote><blockquote type="cite">setting the weight field to Ones. If you set the weight to None, you'll get<br></blockquote><blockquote type="cite">a sum across x.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">You'll probably want to set n_bins to the number of x cells to get what<br></blockquote><blockquote type="cite">you are looking for.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Hope this is helpful,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Jeff<br></blockquote><blockquote type="cite">On Oct 22, 2013 8:25 AM, "Matthew Turk" <<a href="mailto:matthewturk@gmail.com">matthewturk@gmail.com</a>> wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">Hi Sasha,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">I'm not sure I understand what you're looking for.  The functionality to<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">take averages of one field wrt another field might work for what you're<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">looking for, using the BinnedProfile1D object.  If so, you could bin by the<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">"x" field and then take a weighted average of Density.  This might look<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">something like this:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">dd = pf.h.all_data()<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">prof = BinnedProfile1D(dd, n_bins, "x", pf.domain_left_edge[0],<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">pf.domain_right_edge[0], log_space = False)<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">prof.add_fields(["Density"], weight="CellMassMsun")<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Does that help?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Best,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Matt</blockquote></blockquote></div></body></html>