Hi all,<br><br>To follow up: I concur that it should be h^3, not h^4.  I think this is a typo in the original code.  Thanks for catching this!<br><br>--Brian<br><br><div class="gmail_quote">On Tue, May 24, 2011 at 4:52 PM, Michael Kuhlen <span dir="ltr"><<a href="mailto:mqk@astro.berkeley.edu">mqk@astro.berkeley.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi Stephen<br>
<br>
I think it should be h^3, not h^2, because as the comment above says,<br>
"rho0 has units of h^2, dsigmadm has units of h, and massarray has<br>
units of h^-1". The h^-1 factors from massarray actually cancel, since<br>
you multiply by (self.massarray[i+1] - self.massarray[i]) /<br>
self.massarray[i].<br>
<br>
And it should be multiplication, not division, because (for example)<br>
[rho0] = (Msun/h) / (Mpc/h)**3 = Msun/Mpc**3 * h^2, so you have to<br>
multiply rho0 by h^2 to go from (Msun/h)/(Mpc/h)**3 to Msun/Mpc**3.<br>
<br>
Years ago I wrote my own code to calculate P&S, S&T, Jenkins, etc.<br>
mass functions, and I did not use units scaled by h. When I change the<br>
yt code to multiplication by h^3 I find agreement between the yt mass<br>
functions and my own.<br>
<br>
Cheers,<br>
<br>
Mike<br>
<div><div></div><div class="h5"><br>
<br>
On Tue, May 24, 2011 at 1:20 PM, Stephen Skory <<a href="mailto:s@skory.us">s@skory.us</a>> wrote:<br>
> Hi Mike,<br>
><br>
>> 1) In yt/analysis_modules/halo_mass_function/halo_mass_function.py<br>
>>   line 327, shouldn't dn_M_z be multiplied by h^3 instead of h^4?<br>
><br>
> For easy reference here's the function we're talking about:<br>
> <a href="https://bitbucket.org/yt_analysis/yt/src/f8d1ca7f701c/yt/analysis_modules/halo_mass_function/halo_mass_function.py#cl-294" target="_blank">https://bitbucket.org/yt_analysis/yt/src/f8d1ca7f701c/yt/analysis_modules/halo_mass_function/halo_mass_function.py#cl-294</a><br>

><br>
> Thanks for pointing this out, and now that I take a closer look at it<br>
> I'm slightly confused, too, and I may need a pinch hitter to weigh in<br>
> on this (AKA passing the buck). The history of that code is I took<br>
> some C code written by Brian O'Shea and I translated it into Python.<br>
> The C version required re-compiling for any changes, linked to the GNU<br>
> scientific library (which is ubiquitous, of course), and involved a<br>
> multi-step process to get the end product. Converting it to Python<br>
> eliminated these issues, and including it in yt made it more<br>
> convenient. This section is basically verbatim from Brian (code and<br>
> comments), which is clear from the extraneous end-of-expression<br>
> semicolons I was too lazy to remove.<br>
><br>
> You're probably getting the h^3 power based on the comments a few<br>
> lines above #327. But as I look at those comments, it looks like to me<br>
> that a) the power should actually be h^2 (= h^2 * h * h^-1) and that<br>
> b) line 327 should actually be a divide to remove the powers of h.<br>
><br>
> Brian, if you have a moment, can you dig into your memory vault and<br>
> take a look at what Mike has pointed out? Or are we just confused by<br>
> the comments which are misleading? Thanks!<br>
><br>
><br>
> --<br>
> Stephen Skory<br>
> <a href="mailto:s@skory.us">s@skory.us</a><br>
> <a href="http://stephenskory.com/" target="_blank">http://stephenskory.com/</a><br>
> <a href="tel:510.621.3687" value="+15106213687">510.621.3687</a> (google voice)<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>
<br>
<br>
<br>
</div></div><div class="im">--<br>
*********************************************************************<br>
*                                                                   *<br>
*  Dr. Michael Kuhlen              Theoretical Astrophysics Center  *<br>
*  email: <a href="mailto:mqk@astro.berkeley.edu">mqk@astro.berkeley.edu</a>   UC Berkeley                      *<br>
*  cell phone: <a href="tel:%28831%29%20588-1468" value="+18315881468">(831) 588-1468</a>      601 Campbell Hall                *<br>
*  skype username: mikekuhlen      Berkeley, CA 94720               *<br>
*                                                                   *<br>
*********************************************************************<br>
_______________________________________________<br>
</div><div><div></div><div class="h5">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>
</div></div></blockquote></div><br>