Ejemplo n.º 1
0
            'omega_b':0.02225,
            'omega_cdm':0.1198,
            'A_s':A_s,
            'n_s':n_s,
            'tau_reio':0.079,
            'output':'tCl,lCl,mPk,dTk,vTk',
            'use_big_theta_scf': 'yes',
            'scf_has_perturbations': 'yes',
            'attractor_ic_scf': 'no',
            'write background':'yes',
            'compute damping scale':'yes'}
            try:
                cosmo.set(params) # Set the parameters to the cosmological code

                cosmo.compute() # solve physics
                m_axion = 10**cosmo.log10_m_axion()*h*100/_c_
                print "m_axion %f"%(m_axion)
                # k_res_analytical = 0.79*m_axion*Theta_initial[j]*(10**ac[i])
                k_res_analytical = 0.79*m_axion*Theta_initial[j]*(10**ac[i])
                one_time = cosmo.get_transfer(0) # transfer functions at each time tau
                k = one_time['k (h/Mpc)']
                delta_phi_scf = np.abs(one_time['delta_phi_scf']) ##evaluated today
                k_of_delta = interp1d(delta_phi_scf,k)
                background = cosmo.get_background() # load background table
                background_tau = background['conf. time [Mpc]'] # read conformal times in background table
                background_z = background['z'] # read redshift
                background_Om_scf = background['(.)Omega_scf'] # read redshift
                background_z_at_tau = interp1d(background_tau,background_z)
                phi_enveloppe = Theta_initial[j]*10**cosmo.log10_f_axion()*(2/(10**ac[i]))**(-3.*(1+wn)/2/n_axion) ##evaluated today
                delta_max = np.sqrt(delta_phi_scf*delta_phi_scf*A_s*(k/K_star)**(n_s-1))/(phi_enveloppe)
                print max(delta_max), np.where(delta_max==max(delta_max))
Ejemplo n.º 2
0
                        label=r'$f_{\rm EDE}$')
background_phi_scf.set_ylim(tau[0], tau[-1])
background_phi_scf.set_yscale('log')
background_phi_scf.set_xlabel(r'$f_{\rm EDE}(\tau)$')
background_phi_scf.set_xticks([0.0, 0.05, 0.1])
background_phi_scf.set_ylabel(r'$\tau   \,\,\, \mathrm{[Mpc]}$', labelpad=-20)
background_phi_scf.invert_yaxis()
# fig_delta_phi_scf = ax_delta_phi_scf.pcolormesh(K,T,np.log10(delta_phi_scf*delta_phi_scf*K*K*K/2/np.pi/np.pi*A_s*(K/K_star)**(n_s-1)),cmap='coolwarm',vmin=np.log10(delta_phi_scf.min()*delta_phi_scf.min()*K.min()*K.min()*K.min()/2/np.pi*A_s*(K.min()/K_star)**(n_s-1)), vmax=np.log10(delta_phi_scf.max()*delta_phi_scf.max()*K.max()*K.max()*K.max()/2/np.pi*A_s*(K.max()/K_star)**(n_s-1))) #,shading='gouraud')
# fig_delta_phi_scf = ax_delta_phi_scf.pcolormesh(K,T,np.log10(delta_phi_scf*delta_phi_scf*A_s*(K/K_star)**(n_s-1)),cmap='coolwarm',vmin=np.log10(delta_phi_scf.min()*delta_phi_scf.min()*A_s*(K.min()/K_star)**(n_s-1)), vmax=np.log10(delta_phi_scf.max()*delta_phi_scf.max()*A_s*(K.max()/K_star)**(n_s-1))) #,shading='gouraud')
# ##delta_phi power spectrum
phi_enveloppe = Theta_initial * 10**M.log10_f_axion() * (
    1.7 /
    (10**log10_axion_ac * background_z_at_tau(T)))**(-3. *
                                                     (1 + wn) / 2 / n_axion)

print 10**M.log10_f_axion(), 10**M.log10_m_axion(
), Theta_initial * 10**M.log10_f_axion() * 2**(-3. * (1 + wn) / 2 / n_axion)

background_phi_scf_v2 = background_phi_scf.twiny()
background_phi_scf_v2.set_ylim(tau[0], tau[-1])
# background_phi_scf_v2.set_xlim(phi_enveloppe[0],2*phi_enveloppe[-1])
background_phi_scf_v2.plot(phi_enveloppe / (10**M.log10_f_axion()),
                           tau,
                           'r--',
                           linewidth=2)
background_phi_scf_v2.set_xlabel(r'$\Theta=\phi/f_a$', fontsize=18)
# background_phi_scf_v2.set_xticks([0.0,0.5,1])
background_phi_scf_v2.invert_yaxis()
background_phi_scf_v2.plot(background_phi / (10**M.log10_f_axion()),
                           background_tau,
                           'r-',
                           linewidth=2,
Ejemplo n.º 3
0
     one_time = M.get_transfer(background_z_at_tau(tau[i])) # transfer functions at each time tau
     if i ==0:   # if this is the first time in the loop: create the arrays (k, Theta0, phi)
         k = one_time['k (h/Mpc)']
         k_num = len(k)
         Theta0 = np.zeros((tau_num,k_num))
         cs2_fld = np.zeros((tau_num,k_num))
         phi = np.zeros((tau_num,k_num))
     # Theta0[i,:] = 0.25*one_time['d_g'][:]
     a = 1/(1+background_z_at_tau(tau[i]))
     if a > 10**log10ac and i_at_ac == 0:
         i_at_ac=i
     a_osc=10**log10ac/1.7
     w_n = (n_axion-1)/(n_axion+1)
     theta_osc = Theta_initial_fld *(a/a_osc)**(-3*(1+w_n)/(2*n_axion))
     c = 3e5
     m = 10**M.log10_m_axion()*M.h()*100/c
     # print "m:",m
     omega = m*np.sqrt(np.pi)*gamma((1.0+n_axion)/(2.0*n_axion))/gamma(1.0+1.0/(2*n_axion))*2**(-(1.0+n_axion)/2.0)*theta_osc**(n_axion-1.0)
     # print "omega:",omega
     cs2_fld[i,:] = (2*a*a*(n_axion-1)*omega*omega+k*k)/(2*a*a*(n_axion+1)*omega*omega+k*k)
     phi[i,:] = one_time['phi'][:]
 # Omega_scf = bg['(.)Omega_scf']
 H = background['H [1/Mpc]']
 Da = background['ang.diam.dist.']
 z = background['z']
 # tau = background['conf. time [Mpc]']
 # H_of_z = interp1d(z,H)
 zc = 1/(10**log10ac)-1
 tau_ac = background_tau_at_z(zc)
 k_of_cs2_at_ac = interp1d(cs2_fld[i_at_ac,:],k)
 print cs2_fld[i_at_ac,:],i_at_ac
Ejemplo n.º 4
0
            print i, j
            # going over a_c and Om_fld values
            params['log10_fraction_axion_ac'] = fEDE[j]

            cosmo.empty()
            cosmo.struct_cleanup()
            # ensuring memory isn't being eaten up

            # 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

                alpha[i][j] = (cosmo.log10_f_axion())
                mu[i][j] = (cosmo.log10_m_axion())
                # zc[i][j] = np.log10(cosmo.zc())

            except CosmoComputationError:  # this happens when CLASS fails
                pass  # eh, don't do anything

            print('fEDE = %e \t ac = %e \t alpha = %.5f \t mu = %.5f\n' %
                  (fEDE[i], ac[j], alpha[i][j], mu[i][j]))
            # print('fEDE = %e \t mu = %e \t alpha = %.5f \t zc = %.5f\n' %(fEDE[i], mu[j], alpha[i][j], zc[i][j]))

            # # test that stuff is working by plotting the fluid energy density
            # bg = cosmo.get_background()
            # plt.loglog( bg['z'], bg['(.)rho_fld[0]'])
            # plt.show()

###############################################################################################################################################