<jupyter_start><jupyter_text>Produce comoving distances and distance moduli for cosmologies with multiple non-degenerate massive neutrinos, using astropy. Set the cosmological parameter we will use:<jupyter_code># Use these for each test
OmegaC   = 0.25
OmegaB   = 0.05
h        = 0.7
As       = 2.1*10**(-9)

# We set the total number of neutrinos to 3 instead of 3.046
# This is just because astropy only allows splitting Neff equally between all neutrinos species
# So we need an integer to match our code.

Nnu_tot  = 3  

# Use 5 different sets of these parameters
OmegaL    = [0.7, 0.7, 0.7, 0.65, 0.75]
w0        = [-1., -0.9, -0.9, -0.9, -0.9]
wa        = [0., 0., 0.1, 0.1, 0.1]

mnu_set_0 = [0.04, 0.,   0.] * u.eV
mnu_set_1 = [0.05, 0.01, 0.] * u.eV
mnu_set_2 = [0.03, 0.02, 0.04] * u.eV
mnu_set_3 = [0.05, 0.,   0.] * u.eV
mnu_set_4 = [0.03, 0.02, 0.] * u.eV

mnu = [mnu_set_0, mnu_set_1, mnu_set_2, mnu_set_3, mnu_set_4]<jupyter_output><empty_output><jupyter_text>Set up the 5 cosmologies with astropy cosmology objects<jupyter_code>cosmo0 = cosmo.w0waCDM(100*h, OmegaC + OmegaB, OmegaL[0], w0 = w0[0], wa = wa[0], Tcmb0 = 2.725, Neff = Nnu_tot, m_nu= mnu_set_0, Ob0 = OmegaB)
cosmo1 = cosmo.w0waCDM(100*h, OmegaC + OmegaB, OmegaL[1], w0 = w0[1], wa = wa[1], Tcmb0 = 2.725, Neff = Nnu_tot, m_nu= mnu_set_1, Ob0 = OmegaB)
cosmo2 = cosmo.w0waCDM(100*h, OmegaC + OmegaB, OmegaL[2], w0 = w0[2], wa = wa[2], Tcmb0 = 2.725, Neff = Nnu_tot, m_nu= mnu_set_2, Ob0 = OmegaB)
cosmo3 = cosmo.w0waCDM(100*h, OmegaC + OmegaB, OmegaL[3], w0 = w0[3], wa = wa[3], Tcmb0 = 2.725, Neff = Nnu_tot, m_nu= mnu_set_3, Ob0 = OmegaB)
cosmo4 = cosmo.w0waCDM(100*h, OmegaC + OmegaB, OmegaL[4], w0 = w0[4], wa = wa[4], Tcmb0 = 2.725, Neff = Nnu_tot, m_nu= mnu_set_4,Ob0 = OmegaB)<jupyter_output><empty_output><jupyter_text>Set the redshifts<jupyter_code>z = [1., 2., 3., 4., 5.]<jupyter_output><empty_output><jupyter_text>Get the comoving distances<jupyter_code># Loop over models
chi0 = (cosmo0.comoving_distance(z)).value
chi1 = (cosmo1.comoving_distance(z)).value
chi2 = (cosmo2.comoving_distance(z)).value
chi3 = (cosmo3.comoving_distance(z)).value
chi4 = (cosmo4.comoving_distance(z)).value<jupyter_output><empty_output><jupyter_text>Output these to a benchmark file<jupyter_code>with open('./benchmark/chi_mnu_model1-5.txt', 'a') as out_file:
    out_file.write('#z chi(z,model1) chi(z,model2) chi(z,model3) chi(z,model4) chi(z,model5)\n')
    out_file.write(str(z[0])+'\t'+str(chi0[0])+'\t'+str(chi1[0])+'\t'+str(chi2[0])+'\t'+str(chi3[0])+'\t'+str(chi4[0])+'\n')
    out_file.write(str(z[1])+'\t'+str(chi0[1])+'\t'+str(chi1[1])+'\t'+str(chi2[1])+'\t'+str(chi3[1])+'\t'+str(chi4[1])+'\n')
    out_file.write(str(z[2])+'\t'+str(chi0[2])+'\t'+str(chi1[2])+'\t'+str(chi2[2])+'\t'+str(chi3[2])+'\t'+str(chi4[2])+'\n')
    out_file.write(str(z[3])+'\t'+str(chi0[3])+'\t'+str(chi1[3])+'\t'+str(chi2[3])+'\t'+str(chi3[3])+'\t'+str(chi4[3])+'\n')
    out_file.write(str(z[4])+'\t'+str(chi0[4])+'\t'+str(chi1[4])+'\t'+str(chi2[4])+'\t'+str(chi3[4])+'\t'+str(chi4[4])+'\n')<jupyter_output><empty_output><jupyter_text>Get also the distance moduli<jupyter_code>dm0 = (cosmo0.distmod(z)).value
dm1 = (cosmo1.distmod(z)).value
dm2 = (cosmo2.distmod(z)).value
dm3 = (cosmo3.distmod(z)).value
dm4 = (cosmo4.distmod(z)).value<jupyter_output><empty_output><jupyter_text>And output that to file<jupyter_code>with open('./benchmark/dm_mnu_model1-5.txt', 'a') as out_file:
    out_file.write('#z dm(z,model1) dm(z,model2) dm(z,model3) dm(z,model4) dm(z,model5)\n')
    out_file.write(str(z[0])+'\t'+str(dm0[0])+'\t'+str(dm1[0])+'\t'+str(dm2[0])+'\t'+str(dm3[0])+'\t'+str(dm4[0])+'\n')
    out_file.write(str(z[1])+'\t'+str(dm0[1])+'\t'+str(dm1[1])+'\t'+str(dm2[1])+'\t'+str(dm3[1])+'\t'+str(dm4[1])+'\n')
    out_file.write(str(z[2])+'\t'+str(dm0[2])+'\t'+str(dm1[2])+'\t'+str(dm2[2])+'\t'+str(dm3[2])+'\t'+str(dm4[2])+'\n')
    out_file.write(str(z[3])+'\t'+str(dm0[3])+'\t'+str(dm1[3])+'\t'+str(dm2[3])+'\t'+str(dm3[3])+'\t'+str(dm4[3])+'\n')
    out_file.write(str(z[4])+'\t'+str(dm0[4])+'\t'+str(dm1[4])+'\t'+str(dm2[4])+'\t'+str(dm3[4])+'\t'+str(dm4[4])+'\n')<jupyter_output><empty_output><jupyter_text>Now do this for high redshifts<jupyter_code>z_high = [10., 20., 50., 100., 200., 500., 1000.]
# Loop over models
chi0_high = (cosmo0.comoving_distance(z_high)).value
chi1_high = (cosmo1.comoving_distance(z_high)).value
chi2_high = (cosmo2.comoving_distance(z_high)).value
chi3_high = (cosmo3.comoving_distance(z_high)).value
chi4_high = (cosmo4.comoving_distance(z_high)).value
with open('./benchmark/chi_hiz_mnu_model1-5.txt', 'a') as out_file:
    out_file.write('#z chi(z,model1) chi(z,model2) chi(z,model3) chi(z,model4) chi(z,model5)\n')
    out_file.write(str(z_high[0])+'\t'+str(chi0_high[0])+'\t'+str(chi1_high[0])+'\t'+str(chi2_high[0])+'\t'+str(chi3_high[0])+'\t'+str(chi4_high[0])+'\n')
    out_file.write(str(z_high[1])+'\t'+str(chi0_high[1])+'\t'+str(chi1_high[1])+'\t'+str(chi2_high[1])+'\t'+str(chi3_high[1])+'\t'+str(chi4_high[1])+'\n')
    out_file.write(str(z_high[2])+'\t'+str(chi0_high[2])+'\t'+str(chi1_high[2])+'\t'+str(chi2_high[2])+'\t'+str(chi3_high[2])+'\t'+str(chi4_high[2])+'\n')
    out_file.write(str(z_high[3])+'\t'+str(chi0_high[3])+'\t'+str(chi1_high[3])+'\t'+str(chi2_high[3])+'\t'+str(chi3_high[3])+'\t'+str(chi4_high[3])+'\n')
    out_file.write(str(z_high[4])+'\t'+str(chi0_high[4])+'\t'+str(chi1_high[4])+'\t'+str(chi2_high[4])+'\t'+str(chi3_high[4])+'\t'+str(chi4_high[4])+'\n')
    out_file.write(str(z_high[5])+'\t'+str(chi0_high[5])+'\t'+str(chi1_high[5])+'\t'+str(chi2_high[5])+'\t'+str(chi3_high[5])+'\t'+str(chi4_high[5])+'\n')
    out_file.write(str(z_high[6])+'\t'+str(chi0_high[6])+'\t'+str(chi1_high[6])+'\t'+str(chi2_high[6])+'\t'+str(chi3_high[6])+'\t'+str(chi4_high[6])+'\n')
dm0_high = (cosmo0.distmod(z_high)).value
dm1_high = (cosmo1.distmod(z_high)).value
dm2_high = (cosmo2.distmod(z_high)).value
dm3_high = (cosmo3.distmod(z_high)).value
dm4_high = (cosmo4.distmod(z_high)).value
with open('./benchmark/dm_hiz_mnu_model1-5.txt', 'a') as out_file:
    out_file.write('#z dm(z,model1) dm(z,model2) dm(z,model3) dm(z,model4) dm(z,model5)\n')
    out_file.write(str(z_high[0])+'\t'+str(dm0_high[0])+'\t'+str(dm1_high[0])+'\t'+str(dm2_high[0])+'\t'+str(dm3_high[0])+'\t'+str(dm4_high[0])+'\n')
    out_file.write(str(z_high[1])+'\t'+str(dm0_high[1])+'\t'+str(dm1_high[1])+'\t'+str(dm2_high[1])+'\t'+str(dm3_high[1])+'\t'+str(dm4_high[1])+'\n')
    out_file.write(str(z_high[2])+'\t'+str(dm0_high[2])+'\t'+str(dm1_high[2])+'\t'+str(dm2_high[2])+'\t'+str(dm3_high[2])+'\t'+str(dm4_high[2])+'\n')
    out_file.write(str(z_high[3])+'\t'+str(dm0_high[3])+'\t'+str(dm1_high[3])+'\t'+str(dm2_high[3])+'\t'+str(dm3_high[3])+'\t'+str(dm4_high[3])+'\n')
    out_file.write(str(z_high[4])+'\t'+str(dm0_high[4])+'\t'+str(dm1_high[4])+'\t'+str(dm2_high[4])+'\t'+str(dm3_high[4])+'\t'+str(dm4_high[4])+'\n')
    out_file.write(str(z_high[5])+'\t'+str(dm0_high[5])+'\t'+str(dm1_high[5])+'\t'+str(dm2_high[5])+'\t'+str(dm3_high[5])+'\t'+str(dm4_high[5])+'\n')
    out_file.write(str(z_high[6])+'\t'+str(dm0_high[6])+'\t'+str(dm1_high[6])+'\t'+str(dm2_high[6])+'\t'+str(dm3_high[6])+'\t'+str(dm4_high[6])+'\n')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.2727773949000689, 'fraction_numerical': 0.0737422467263956, 'mean_word_length': 6.964873765093304, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '360691', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 3775, 'n_tokens_neox': 3635, 'n_words': 365, 'path': 'benchmarks/data/codes/multiple_neutrino_distances.ipynb', 'repo_name': 'carlosggarcia/CCL', 'size': '7255'}