good_fede = [] good_zc = [] for i in range(N): params['m_axion'] = maxion_table[i] for j in range(N): params['f_axion'] = faxion_table[j] for k in range(N): params['scf_parameters'] = '%.5f,0.0' % theta_initial_table[k] print 'try:', maxion_table[i], faxion_table[ j], theta_initial_table[k] # try to solve with a certain cosmology, no worries if it cannot try: cosmo.set( params) # Set the parameters to the cosmological code cosmo.compute() # solve physics print 'fac:', cosmo.fEDE(), 'log10(zc):', cosmo.zc() print 'good!', maxion_table[i], faxion_table[ j], theta_initial_table[k] # good_maxion[i][j][k]=maxion_table[i] # good_faxion[i][j][k]=faxion_table[j] # good_theta[i][j][k]=theta_initial_table[k] good_maxion.append(np.log10(maxion_table[i])) good_faxion.append(np.log10(faxion_table[j])) good_theta.append(theta_initial_table[k]) good_fede.append(np.log10(cosmo.fEDE())) good_zc.append(cosmo.zc()) except CosmoComputationError: # this happens when CLASS fails # print CosmoComputationError print 'this one was bad...' bad_maxion.append(np.log10(maxion_table[i])) bad_faxion.append(np.log10(faxion_table[j]))
M = Class() # Table I of 1908.06995, third column, best-fit values # Note: f and m found by trial-and-error to give the best-fit fEDE=.12, zc=10^3.562=3647. M.set({'f_scf': 3.98e+26, 'm_scf': 5.31e-28, 'thetai_scf': 2.83, 'A_s': 2.215e-09, 'n_s': 0.9889, '100*theta_s': 1.04152, 'omega_b': 0.02253, 'omega_cdm': 0.1306, 'm_ncdm': 0.06, 'tau_reio': 0.072}) #'non linear':can choose 'halofit' or 'HMCODE' M.set({'non linear':'HMCODE','N_ncdm':1, 'N_ur':2.0328, 'Omega_Lambda':0.0, 'Omega_fld':0, 'Omega_scf':-1, 'n_scf':3, 'CC_scf':1, 'scf_parameters':'1, 1, 1, 1, 1, 0.0', 'scf_tuning_index':3, 'attractor_ic_scf':'no', 'output':'tCl pCl lCl mPk', 'lensing':'yes', 'l_max_scalars':2508, 'P_k_max_h/Mpc':20,'z_max_pk':4.}) M.compute() print(M.Omega_m()) baM = M.get_background() fEDE = M.fEDE() z_c = M.z_c() baH = baM['H [1/Mpc]'] baT = baM['conf. time [Mpc]'] baa = 1/(1 + baM['z']) bV = baM['V_e_scf'] bpp = baM["phi'_scf"] baCrit = baM['(.)rho_crit'] rho_scf = (bpp*bpp/(2*baa*baa) + bV)/3. plt.figure(figsize=(10,10)) plt.rcParams.update({'font.size': 18}) plt.plot(baM['z'],rho_scf/baCrit,lw=2,c='k') plt.axhline(fEDE,c='r',ls='--')