def integrate_halo(ell, lnzarr, chiarr, dVdzdOm, marr, mf, BDarr, rhobarr, rho_crit_arr, bias, Darr, pk, zsarr, chisarr, Ns, dlnz, dlnm, omega_b0, omega_m0, cosmo_h, constk, consty, input_mvir): ''' Eq. 3.1 Ma et al. ''' cl1h = 0.0 cl2h = 0.0 jj = 0 for i, lnzi in enumerate(lnzarr): zi = np.exp(lnzi) - 1. zp = 1. + zi #print zi, Wk(zi, chiarr[i], zsarr, angsarr, Ns, constk) kl_yl_multi = Wk(zi, chiarr[i], zsarr, chisarr, Ns, constk) * consty / chiarr[i] / chiarr[i] / rhobarr[i] mint = 0.0 mk2 = 0.0 my2 = 0.0 for mi in marr: kint = 0.0 yint = 0.0 if input_mvir: Mvir, Rvir, M200, R200, rho_s, Rs = MvirToMRfrac( mi, zi, BDarr[i], rho_crit_arr[i], cosmo_h, frac=200.0) else: Mvir, Rvir, M200, R200, rho_s, Rs = MfracToMvir( mi, zi, BDarr[i], rho_crit_arr[i], cosmo_h, frac=200.0) #Eq. 3.2 Ma et al rp = np.linspace(0, config.kRmax * Rvir, config.kRspace) for tr in rp: if tr == 0: continue kint += (tr * tr * np.sin(ell * tr / chiarr[i]) / (ell * tr / chiarr[i]) * rho_s / (tr / Rs) / (1. + tr / Rs)**2.) kint *= (4. * np.pi * (rp[1] - rp[0])) #Eq. 3.3 Ma et al xmax = config.yRmax * Rvir / Rs #Ma et al paper says that Eq. 3.3 convergence by r=5 rvir. xp = np.linspace(0, xmax, config.yRspace) ells = chiarr[i] / zp / Rs for x in xp: if x == 0: continue yint += (x * x * np.sin(ell * x / ells) / (ell * x / ells) * battaglia_profile_2d( x, 0., Rs, M200, R200, zi, rho_crit_arr[i], omega_b0, omega_m0, cosmo_h)) yint *= (4 * np.pi * Rs * (xp[1] - xp[0]) / ells / ells) mint += (dlnm * mf[jj] * kint * yint) mk2 += (dlnm * bias[jj] * mf[jj] * kint) my2 += (dlnm * bias[jj] * mf[jj] * yint) jj += 1 cl1h += (dVdzdOm[i] * kl_yl_multi * mint * zp) cl2h += (dVdzdOm[i] * pk[i] * Darr[i] * Darr[i] * kl_yl_multi * mk2 * my2) cl1h *= dlnz cl2h *= dlnz cl = cl1h + cl2h return cl1h, cl2h, cl
def integrate_yyhalo(ell, lnzarr, chiarr, dVdzdOm, marr, mf, BDarr, rhobarr, rho_crit_arr, bias, Darr, pk, dlnz, dlnm, omega_b0, omega_m0, cosmo_h, constk, consty, input_mvir): ''' Eq. 3.1 Ma et al. ''' cl1h = 0.0 cl2h = 0.0 jj = 0 for i, lnzi in enumerate(lnzarr[:]): zi = np.exp(lnzi) - 1. zp = 1. + zi mint = 0.0 my2 = 0.0 for j, mi in enumerate(marr[:]): if input_mvir: Mvir, Rvir, M200, R200, rho_s, Rs = MvirToMRfrac( mi / cosmo_h, zi, BDarr[i], rho_crit_arr[i] * cosmo_h * cosmo_h, cosmo_h, frac=200.0) else: Mvir, Rvir, M200, R200, rho_s, Rs = MfracToMvir( mi, zi, BDarr[i], rho_crit_arr[i], cosmo_h, frac=200.0) xmax = config.yRmax * Rvir / Rs ells = chiarr[i] / cosmo_h / zp / Rs xarr = np.linspace(1e-5, xmax, config.yRspace) yint = 0. for x in xarr: if x == 0: continue yint += (x * x * np.sin(ell * x / ells) / (ell * x / ells) * battaglia_profile_2d( x, 0., Rs, M200, R200, zi, rho_crit_arr[i] * cosmo_h * cosmo_h, omega_b0, omega_m0, cosmo_h)) yint *= (4 * np.pi * Rs * (xarr[1] - xarr[0]) / ells / ells) mint += (dlnm * mf[jj] * yint * yint) my2 += (dlnm * bias[jj] * mf[jj] * yint) jj += 1 cl1h += (dVdzdOm[i] * consty * consty * mint * zp) cl2h += (dVdzdOm[i] * pk[i] * Darr[i] * Darr[i] * consty * consty * my2 * my2 * zp) cl1h *= dlnz cl2h *= dlnz cl = cl1h + cl2h return cl1h, cl2h, cl
def integrate_kkhalo(ell, zarr, chiarr, dVdzdOm, marr, mf, BDarr, rhobarr, rho_crit_arr, bias, Darr, pk, zsarr, chisarr, Ns, dz, dlnm, omega_b0, omega_m0, cosmo_h, constk, consty, input_mvir): ''' Eq. 3.1 Ma et al. ''' cl1h = 0.0 cl2h = 0.0 jj = 0 for i, zi in enumerate(zarr): zp = 1. + zi #print zi, Wkcom(zi, chiarr[i], zsarr, angsarr, Ns, constk) kl_multi = Wkcom(zi, chiarr[i], zsarr, chisarr, Ns, constk) / chiarr[i] / chiarr[i] / rhobarr[i] mint = 0.0 mk2 = 0.0 #for mi in marr: for j in range(config.mspace): mi = marr[jj] kint = 0.0 if input_mvir: Mvir, Rvir, M200, R200, rho_s, Rs = MvirToMRfrac( mi, zi, BDarr[i], rho_crit_arr[i], cosmo_h, frac=200.0) else: Mvir, Rvir, M200, R200, rho_s, Rs = MfracToMvir( mi, zi, BDarr[i], rho_crit_arr[i], cosmo_h, frac=200.0) #Eq. 3.2 Ma et al #limit_kk_Rvir.py tests the limit of Rvir. rp = np.linspace(0, config.kRmax * Rvir, config.kRspace) for tr in rp: if tr == 0: continue kint += (tr * tr * np.sin(ell * tr / chiarr[i]) / (ell * tr / chiarr[i]) * rho_s / (tr / Rs) / (1. + tr / Rs)**2.) kint *= (4. * np.pi * (rp[1] - rp[0])) mint += (dlnm * mf[jj] * kint * kint) mk2 += (dlnm * bias[jj] * mf[jj] * kint) jj += 1 cl1h += (dVdzdOm[i] * kl_multi * kl_multi * mint) cl2h += (dVdzdOm[i] * pk[i] * Darr[i] * Darr[i] * kl_multi * kl_multi * mk2 * mk2) cl1h *= dz cl2h *= dz cl = cl1h + cl2h return cl1h, cl2h, cl