[yt-users] possible bugs in analytical mass function code and halo profiler code
Michael Kuhlen
mqk at astro.berkeley.edu
Tue May 24 13:52:43 PDT 2011
Hi Stephen
I think it should be h^3, not h^2, because as the comment above says,
"rho0 has units of h^2, dsigmadm has units of h, and massarray has
units of h^-1". The h^-1 factors from massarray actually cancel, since
you multiply by (self.massarray[i+1] - self.massarray[i]) /
self.massarray[i].
And it should be multiplication, not division, because (for example)
[rho0] = (Msun/h) / (Mpc/h)**3 = Msun/Mpc**3 * h^2, so you have to
multiply rho0 by h^2 to go from (Msun/h)/(Mpc/h)**3 to Msun/Mpc**3.
Years ago I wrote my own code to calculate P&S, S&T, Jenkins, etc.
mass functions, and I did not use units scaled by h. When I change the
yt code to multiplication by h^3 I find agreement between the yt mass
functions and my own.
Cheers,
Mike
On Tue, May 24, 2011 at 1:20 PM, Stephen Skory <s at skory.us> wrote:
> Hi Mike,
>
>> 1) In yt/analysis_modules/halo_mass_function/halo_mass_function.py
>> line 327, shouldn't dn_M_z be multiplied by h^3 instead of h^4?
>
> For easy reference here's the function we're talking about:
> https://bitbucket.org/yt_analysis/yt/src/f8d1ca7f701c/yt/analysis_modules/halo_mass_function/halo_mass_function.py#cl-294
>
> Thanks for pointing this out, and now that I take a closer look at it
> I'm slightly confused, too, and I may need a pinch hitter to weigh in
> on this (AKA passing the buck). The history of that code is I took
> some C code written by Brian O'Shea and I translated it into Python.
> The C version required re-compiling for any changes, linked to the GNU
> scientific library (which is ubiquitous, of course), and involved a
> multi-step process to get the end product. Converting it to Python
> eliminated these issues, and including it in yt made it more
> convenient. This section is basically verbatim from Brian (code and
> comments), which is clear from the extraneous end-of-expression
> semicolons I was too lazy to remove.
>
> You're probably getting the h^3 power based on the comments a few
> lines above #327. But as I look at those comments, it looks like to me
> that a) the power should actually be h^2 (= h^2 * h * h^-1) and that
> b) line 327 should actually be a divide to remove the powers of h.
>
> Brian, if you have a moment, can you dig into your memory vault and
> take a look at what Mike has pointed out? Or are we just confused by
> the comments which are misleading? Thanks!
>
>
> --
> Stephen Skory
> s at skory.us
> http://stephenskory.com/
> 510.621.3687 (google voice)
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
--
*********************************************************************
* *
* Dr. Michael Kuhlen Theoretical Astrophysics Center *
* email: mqk at astro.berkeley.edu UC Berkeley *
* cell phone: (831) 588-1468 601 Campbell Hall *
* skype username: mikekuhlen Berkeley, CA 94720 *
* *
*********************************************************************
More information about the yt-users
mailing list