Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] neutrino mass incorrectly implemented #117

Open
liuxx479 opened this issue Dec 12, 2020 · 3 comments
Open

[BUG] neutrino mass incorrectly implemented #117

liuxx479 opened this issue Dec 12, 2020 · 3 comments
Assignees

Comments

@liuxx479
Copy link
Contributor

Describe the bug
Neutrino mass parameter is not properly modeled right now, because astropy takes in m_nu (in unit of eV), but camb uses omnuh2 (no unit).

To Reproduce
Steps to reproduce the behavior:

from astropy import units as u
tr0 = Transfer(cosmo_params={"m_nu":u.eV*np.array([0,0,0]) })
tr1 = Transfer(cosmo_params={"m_nu":u.eV*np.array([0.1, 0.1, 0.1]) } )

tr0.transfer_function - tr1.transfer_function

would show 0, meaning massive and massless neutrinos have identical transfer functions, because m_nu parameter is not passed on to camb

Expected behavior
tr0.transfer_function - tr1.transfer_function should be different

Additional context
I have a quick fix by redefining the CDM parameter omch2:

change line 212 in hmf/density_field/transfer_models.py from:
omch2=(self.cosmo.Om0 - self.cosmo.Ob0) * self.cosmo.h ** 2
to:
omch2=(self.cosmo.Om0 - self.cosmo.Ob0) * self.cosmo.h ** 2 - sum(self.cosmo.m_nu.value)/93.14

But I think there should be a better way to do it.

@steven-murray
Copy link
Collaborator

steven-murray commented Dec 14, 2020 via email

@liuxx479
Copy link
Contributor Author

liuxx479 commented Dec 14, 2020

Hi Steven,
camb requires neutrino hierarchy, number of massive neutrinos, and total neutrino mass and compute the rest automatically:
e.g.
neutrino_hierarchy: Union[str, int] = 'degenerate', num_massive_neutrinos=1,mnu=0.06,
And yes, you need to manually calculate omch2 (in our case, subtracting massive neutrino by hand).

I did a bit editing from my original proposal - instead of manually calculate omega_nu, I use the calculation directly from astropy. I fixed the splitting to degenerate since it should be sufficient for any realistic usage.. I submitted a PR.

A more complicated fix (any neutrino mass values and splitting) can probably be done with more care, following the description under set_cosmology in https://camb.readthedocs.io/en/latest/_modules/camb/model.html#CAMBparams

@liuxx479
Copy link
Contributor Author

After the first attempt to fix the issue (but fixing the input parameter for camb), my colleague brought to my attention that for neutrinos, the best match of HMF (to simulations) is achieved using P_cb and rho_cb (cb=cdm+baryons) during calculation (though the background cosmology does take into account of massive neutrinos), instead of P_matter and rho_matter (matter = cdm+baryon+neutrinos). See fig. 1 of: https://arxiv.org/abs/1311.1514

Screen Shot 2020-12-21 at 4 10 14 PM

Implementation of this is more involved.. I will come back to it later..

@github-actions github-actions bot removed the Type: bug label Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants