halomod / hmf

Python halo mass function calculator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Potential bug in CAMB transfer at high k

steven-murray opened this issue · comments

There seems to be extra power in CAMB at high k compared to EH. This may be due to an update in CAMB, but also may be the way it's being extrapolated. See the component showcase demo for details.

image

Hi @steven-murray did you figure out what was happening here and why did you close the issue? I'm using the most recent version of hmf and CAMB and getting this issue.

It has quite a big impact at high z. It might be good to flag this in the docs and/or make CAMB not the default.

Hi @charlottenosam, this was a strange issue. I think it was a combined issue with a CAMB update changing the range of k that is computed by default in CAMB, and then hmf not extrapolating that appropriately. But I can't specifically prove which version of CAMB updated the range.

Anyway, to fix it, there's a couple of things you can do, and it has been made slightly easier in the most recent versions of hmf (v3.3.0+). Here's the note from the changelog:

  • Option to extrapolate high-k for CAMB transfer using EH. This gives a fast and reasonably consistent high-k transfer function. If not extrapolating with EH (which is still the default) you can now set transfer_params={'kmax':1e3} to get better low-mass/small-scale accuracy. By default, kmax is the same as the default from CAMB, which is about 1.4 h/Mpc. Above this value, the transfer function is by default linearly extrapolated in log-log space.

So, if you set transfer_params={"extrapolate_with_eh":True}, it will use EH at high-k and CAMB at low-k (in the middle few bins it will merge them so that there's not a sharp transition). To be more accurate you can use the transfer_params={'kmax':1e3}, which will force CAMB to actually calculate out to higher k. Note that this can take a LONG time.

As for using CAMB as default -- it is now only used by default if it is installed, and it is NOT installed by default from hmf. In v4.0.0, it may be a good idea to switch over to EH by default regardless of what is installed.

Hi @steven-murray, thanks for the explanation - glad to hear there's a workaround! I think I'll stick with EH for now. FYI readthedocs only shows up to v3.1.0 so this isn't logged there.

Ah, thanks for pointing that out. I'll give it a look.