[yt-dev] Issue #1237: HaloMassFcn units (or coments) inconsistent (yt_analysis/yt)

spthm issues-reply at bitbucket.org
Wed Jun 29 12:07:56 PDT 2016


New issue 1237: HaloMassFcn units (or coments) inconsistent
https://bitbucket.org/yt_analysis/yt/issues/1237/halomassfcn-units-or-coments-inconsistent

spthm:

Disclaimer: I'm not particularly experienced in HMFs. The below may not actually be a bug (just confusing/incorrect comments); if it is, I imagine it relates to issue #1228. It should possibly be a comment on that issue, but I can't confirm the two are related.

For reference, I'm going to link to the current stable yt, 3.2.3.

Based on comments in [`halo_mass_function.py`](https://bitbucket.org/yt_analysis/yt/src/bdea84d950999973d7b80cba34acc4c70b62a925/yt/analysis_modules/halo_mass_function/halo_mass_function.py?at=stable&fileviewer=file-view-default#halo_mass_function.py), I do not believe the stated output units are correct.

[`halo_mass_function.py:403`](https://bitbucket.org/yt_analysis/yt/src/bdea84d950999973d7b80cba34acc4c70b62a925/yt/analysis_modules/halo_mass_function/halo_mass_function.py?at=stable&fileviewer=file-view-default#halo_mass_function.py-403) multiplies `rho_crit_g_cm3_h2` by `hubble0**2`, resulting in units of `Msolar/Mpc^3` for `rho0` _if the comment at [`physical_ratios.py:103`](https://bitbucket.org/yt_analysis/yt/src/bdea84d950999973d7b80cba34acc4c70b62a925/yt/utilities/physical_ratios.py?at=yt&fileviewer=file-view-default#physical_ratios.py-103) is to be believed_. But line 402 directly above states `rho0 in units of h^2 Msolar/Mpc^3`.

This error carries through to line [`halo_mass_function.py:432`](https://bitbucket.org/yt_analysis/yt/src/bdea84d950999973d7b80cba34acc4c70b62a925/yt/analysis_modules/halo_mass_function/halo_mass_function.py?at=stable&fileviewer=file-view-default#halo_mass_function.py-432). It is claimed that `dndM_dM_analytic` has units of `h^3`, but it is actually `h`.

Finally, at [`halo_mass_function.py:436`](https://bitbucket.org/yt_analysis/yt/src/bdea84d950999973d7b80cba34acc4c70b62a925/yt/analysis_modules/halo_mass_function/halo_mass_function.py?at=stable&fileviewer=file-view-default#halo_mass_function.py-436) we multiply through by `h^3`, resulting units of `h^-2` for `dndM_dM_analytic` and `n_cumulative_analytic` (while it is claimed that all `h` are cancelled out).

Note that [`halo_mass_function.py:368`](https://bitbucket.org/yt_analysis/yt/src/bdea84d950999973d7b80cba34acc4c70b62a925/yt/analysis_modules/halo_mass_function/halo_mass_function.py?at=stable&fileviewer=file-view-default#halo_mass_function.py-368) has a similar issue, in that `h^2` units are claimed, but `rho0` has no `h` dependence. The proceeding usage of `rho0` at [`halo_mass_function.py:390`](https://bitbucket.org/yt_analysis/yt/src/bdea84d950999973d7b80cba34acc4c70b62a925/yt/analysis_modules/halo_mass_function/halo_mass_function.py?at=stable&fileviewer=file-view-default#halo_mass_function.py-390) implies that `rho0` indeed should have units `h^2` to achieve a `h^-1` for `thisradius`. I think this has a non-trivial impact on the values in `sigmaarray`, but I gave up trying to track it.

The masses do not appear to be affected, but both analytic output arrays seem to have erroneous factors of `h`, and I believe the sigma values are also computed with incorrect `R` values.  Since I gave up trying to track how incorrect `R` impacts `sigma`, I don't know if this all agrees with the behaviour described by @ioodderskov in #1228.

All that said, if I make the obvious change of _not_ multiplying `rho` by `hubble0**2`, the analytic fits do a much worse job of fitting haloes in some of my Gadget-2 snapshots, whereas before agreement with P-S was very good. But I have no idea if this is a fluke, and the simulations are faulty, or whether all of the above is a misunderstanding on my part.

The multiplication by `hubble0**2` was introduced in ab0d4e0. 




More information about the yt-dev mailing list