LSSTDESC / CCL

DESC Core Cosmology Library: cosmology routines with validated numerical accuracy
BSD 3-Clause "New" or "Revised" License
145 stars 64 forks source link

Costanzi et al. 2013 prescription on halo mass function with massive neutrinos #1179

Open vittoriodx7 opened 4 months ago

vittoriodx7 commented 4 months ago

In my recent cosmological analysis using pyCCL it came out during peer review that Costanzi et al. 2013 (https://ui.adsabs.harvard.edu/abs/2013JCAP...12..012C/abstract) prescription has to be used in the presence of massive neutrinos when computing the halo mass function.

I had edited a local version of pyCCL by:

in halos/halo_model_base.py at line 196, rho = (const.RHO_CRITICAL * cosmo['Omega_m'] * cosmo['h']**2) should become:

        use_costanzi13=False
        try:
            use_costanzi13=cosmo["extra_parameters"]["use_costanzi13"]
        except (KeyError, TypeError):
            pass
        if not use_costanzi13:
            rho = (const.RHO_CRITICAL * cosmo['Omega_m'] * cosmo['h']**2)
        else:
            rho = (const.RHO_CRITICAL * (cosmo['Omega_c'] + cosmo['Omega_b']) * cosmo['h']**2)

and in boltzmann.py I suggest inserting at line 37:

use_costanzi13=False
    try:
        use_costanzi13=cosmo["extra_parameters"]["use_costanzi13"]
    except (KeyError, TypeError):
        pass

and then line 154, the CAMB call to get the power spectrum should become:

        if not use_costanzi13:
            k, z, pk = camb_res.get_linear_matter_power_spectrum(
            hubble_units=True, nonlinear=nonlin)
        else:
            k, z, pk = camb_res.get_linear_matter_power_spectrum(var1='delta_nonu', var2='delta_nonu', hubble_units=True, nonlinear=nonlin)

In this way if a user does not want to use it the code is unchanged, but if a user wants to use it they can pass it as an extra parameter in the call to pyccl.cosmology, e.g.:

pyccl.Cosmology(..., extra_parameters={"use_costanzi13": True}) to allow this prescription to take place.

I therefore suggest this easy to do and backward compatible edit to the code to made available, if possible.

Thanks, Vittorio