|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
get_ipython().run_line_magic('matplotlib', 'inline') |
|
import matplotlib |
|
import matplotlib.pyplot as plt |
|
import numpy as np |
|
from classy import Class |
|
from scipy.optimize import fsolve |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_masses(delta_m_squared_atm, delta_m_squared_sol, sum_masses, hierarchy): |
|
|
|
if 'n' in hierarchy.lower(): |
|
|
|
|
|
|
|
|
|
m1_func = lambda m1, M_tot, d_m_sq_atm, d_m_sq_sol: M_tot**2. + 0.5*d_m_sq_sol - d_m_sq_atm + m1**2. - 2.*M_tot*m1 - 2.*M_tot*(d_m_sq_sol+m1**2.)**0.5 + 2.*m1*(d_m_sq_sol+m1**2.)**0.5 |
|
m1,opt_output,success,output_message = fsolve(m1_func,sum_masses/3.,(sum_masses,delta_m_squared_atm,delta_m_squared_sol),full_output=True) |
|
m1 = m1[0] |
|
m2 = (delta_m_squared_sol + m1**2.)**0.5 |
|
m3 = (delta_m_squared_atm + 0.5*(m2**2. + m1**2.))**0.5 |
|
return m1,m2,m3 |
|
else: |
|
|
|
|
|
|
|
|
|
delta_m_squared_atm = -delta_m_squared_atm |
|
m1_func = lambda m1, M_tot, d_m_sq_atm, d_m_sq_sol: M_tot**2. + 0.5*d_m_sq_sol - d_m_sq_atm + m1**2. - 2.*M_tot*m1 - 2.*M_tot*(d_m_sq_sol+m1**2.)**0.5 + 2.*m1*(d_m_sq_sol+m1**2.)**0.5 |
|
m1,opt_output,success,output_message = fsolve(m1_func,sum_masses/3.,(sum_masses,delta_m_squared_atm,delta_m_squared_sol),full_output=True) |
|
m1 = m1[0] |
|
m2 = (delta_m_squared_sol + m1**2.)**0.5 |
|
m3 = (delta_m_squared_atm + 0.5*(m2**2. + m1**2.))**0.5 |
|
return m1,m2,m3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
m1,m2,m3 = get_masses(2.45e-3,7.50e-5,0.1,'NH') |
|
print ('NH:',m1,m2,m3,m1+m2+m3) |
|
m1,m2,m3 = get_masses(2.45e-3,7.50e-5,0.1,'IH') |
|
print ('IH:',m1,m2,m3,m1+m2+m3) |
|
|
|
|
|
|
|
|
|
|
|
|
|
commonsettings = {'N_ur':0, |
|
'N_ncdm':3, |
|
'output':'mPk', |
|
'P_k_max_1/Mpc':3.0, |
|
|
|
'ncdm_fluid_approximation':3, |
|
|
|
'background_verbose':1 |
|
} |
|
|
|
|
|
kvec = np.logspace(-4,np.log10(3),100) |
|
|
|
legarray = [] |
|
|
|
|
|
for sum_masses in [0.1, 0.115, 0.13]: |
|
|
|
[m1, m2, m3] = get_masses(2.45e-3,7.50e-5, sum_masses, 'NH') |
|
NH = Class() |
|
NH.set(commonsettings) |
|
NH.set({'m_ncdm':str(m1)+','+str(m2)+','+str(m3)}) |
|
NH.compute() |
|
|
|
[m1, m2, m3] = get_masses(2.45e-3,7.50e-5, sum_masses, 'IH') |
|
IH = Class() |
|
IH.set(commonsettings) |
|
IH.set({'m_ncdm':str(m1)+','+str(m2)+','+str(m3)}) |
|
IH.compute() |
|
pkNH = [] |
|
pkIH = [] |
|
for k in kvec: |
|
pkNH.append(NH.pk(k,0.)) |
|
pkIH.append(IH.pk(k,0.)) |
|
NH.struct_cleanup() |
|
IH.struct_cleanup() |
|
|
|
h = NH.h() |
|
plt.semilogx(kvec/h,1-np.array(pkNH)/np.array(pkIH)) |
|
legarray.append(r'$\Sigma m_i = '+str(sum_masses)+'$eV') |
|
plt.axhline(0,color='k') |
|
plt.xlim(kvec[0]/h,kvec[-1]/h) |
|
plt.xlabel(r'$k [h \mathrm{Mpc}^{-1}]$') |
|
plt.ylabel(r'$1-P(k)^\mathrm{NH}/P(k)^\mathrm{IH}$') |
|
plt.legend(legarray) |
|
plt.savefig('neutrinohierarchy.pdf') |
|
|
|
|