Ejemplo n.º 1
0
def C_l_mu_single_ell(ell):
    Kp = np.geomspace(1e-4, 100, n_points)
    Mu = np.linspace(-0.9999, 0.9999, n_points)
    Z = np.geomspace(1e-4, z_r, n_points)
    mu, kp, z = np.meshgrid(Mu, Kp, Z)
    H_z = uf.H(Z)
    chi_z = uf.chi(Z)
    #chi_Z=chi(Z)
    tau_z = uf.tau_inst(Z)
    f_z = uf.f(Z)
    D_z = uf.D_1(Z)
    const = 1e12 * T_rad**2 * x**2 / cc.c_light_Mpc_s * (
        sigma_T * rho_g0 / (mu_e * m_p))**2 / 8 / np.pi**2
    #kp_norm=np.linalg.norm(Kp)
    #k_norm=np.linalg.norm(ell/chi_Z)
    k = ell / chi_z
    K = np.sqrt(k**2 + kp**2 - 2 * k * kp * mu)
    integral = sp.integrate.trapz(sp.integrate.trapz(
        sp.integrate.trapz(Mps_interpf(kp) * np.exp(-2 * tau_z) * f_z**2 *
                           D_z**4 * H_z * (1 - mu**2) * (1 + z)**2 / chi_z**2,
                           Mu,
                           axis=0),
        Kp,
        axis=0),
                                  Z,
                                  axis=0)
    return integral
Ejemplo n.º 2
0
def powerspec_final(ell):
    z1, z2 = np.meshgrid(z, z)
    chi_z1 = chi(z1)
    chi_z2 = chi(z2)
    f_z1 = uf.f(z1)
    f_z2 = uf.f(z2)
    D_z1 = uf.D_1(z1)
    D_z2 = uf.D_1(z2)
    tau_z1 = tau(z1)
    tau_z2 = tau(z2)
    H_z = uf.H(z)
    chi_z = chi(z)
    tau_z = uf.tau_inst(z)
    f_z = uf.f(z)
    D_z = uf.D_1(z)
    Mps = np.array([])
    for i in ell:
        Integrand = [
            sp.integrate.trapz(powerspec(np.sqrt(j**2 + i**2 / chi_z**2)), z)
            for j in kpar
        ]
        Integral = sp.integrate.trapz(Integrand, kpar)
        #Integral=sp.integrate.trapz((1+z)**2/chi_z**2*powerspec(i/chi_z)*D_z**4*H_z*f_z**2*np.exp(-2*tau_z),z)
        #Integral=[sp.integrate.trapz(sp.integrate.trapz((1+z1)*(1+z2)*np.exp(-tau_z1)
        #*np.exp(-tau_z2)*2*f_z1*f_z2*D_z1**2*D_z2**2/chi_z1**2*powerspec(i/chi_z1),z,axis=0),z,axis=0)]
        Mps = np.append(Mps, Integral)
    return Mps
Ejemplo n.º 3
0
def C_l_integrand(ell, z):
    Kp = np.geomspace(1e-4, k_max, n_points)
    Mu = np.linspace(-0.9999, 0.9999, n_points)
    mu, kp = np.meshgrid(Mu, Kp)
    H_z = uf.H(z)
    chi_z = uf.chi(z)
    #chi_Z=chi(Z)
    tau_z = uf.tau_inst(z)
    f_z = uf.f(z)
    D_z = uf.D_1(z)
    const = 1e12 * T_rad**2 * x**2 / cc.c_light_Mpc_s * (
        sigma_T * rho_g0 / (mu_e * m_p))**2 / 8 / np.pi**2
    #kp_norm=np.linalg.norm(Kp)
    #k_norm=np.linalg.norm(ell/chi_Z)
    C_l = np.array([])
    for i in ell:
        k = i / chi_z
        K = np.sqrt(np.abs(k**2 + kp**2 - 2 * k * kp * mu))
        integral = [
            const * sp.integrate.trapz(sp.integrate.trapz(
                k * (k - 2 * kp * mu) *
                (1 - mu**2) / K**2 * Mps_interpf(kp) * Mps_interpf(K) *
                (1 + z)**2 * np.exp(-2 * tau_z) * f_z**2 * D_z**4 / chi_z**2 *
                H_z,
                Mu,
                axis=0),
                                       Kp,
                                       axis=0)
        ]
        C_l = np.append(C_l, integral)
    return C_l
Ejemplo n.º 4
0
def vis_function(z):
    delta_z = 0.5
    delta_y = 1.5 * np.sqrt(1 + z_r) * delta_z
    x = (1 / 2) * (1 + np.tanh((y(z_r) - y(z)) / delta_y))
    #x_H=1/(1+np.exp(-(z-z_r)/delta_z))
    vis_function = cc.c_light_Mpc_s * sigma_T * rho_g0 / mu_e / m_p * (
        1 + z)**2 * np.exp(-uf.tau_inst(z)) * (x) / H(z)
    return vis_function
Ejemplo n.º 5
0
def crosscorr_rec_coords(
    ell, z_i, y, delta_z
):  #with the assumption that zi=z so no cos factor, and we have dz=redshift bin width=2*delta_z defined above
    n = n_points  #number of points over which to integrate
    Kp_par = np.geomspace(1.e-6, .15, n)
    Kp_perp = np.geomspace(1.e-6, 1., n)
    Z_min = z_i - delta_z
    Z_max = z_i + delta_z
    Z = np.geomspace(Z_min, Z_max, n)
    kp_perp, kp_par, z = np.meshgrid(Kp_perp, Kp_par, Z)
    chi_z = chi(z)
    T_mean_zi = uf.T_mean(z_i)
    chi_zi = chi(z_i)
    chi_z = chi(z)
    f_zi = uf.f(z_i)
    f_z = uf.f(z)
    D_zi = uf.D_1(z_i)
    r_zi = uf.r(z_i)
    D_z = uf.D_1(z)
    H_zi = uf.H(z_i)
    tau_z = uf.tau_inst(z)
    kpar = y / uf.r(z)
    const = 1.e6 / (
        4. * np.pi**2
    ) * T_rad * T_mean_zi**2 / cc.c_light_Mpc_s * f_zi * D_zi**2 * H_zi / (
        chi_zi**2 * r_zi) / (1. + z_i) * x * (sigma_T * rho_g0 / (mu_e * m_p))
    kperp = ell / chi_z
    k = np.sqrt(kperp**2 + kpar**2)
    kp = np.sqrt(kp_perp**2 + kp_par**2)
    cos_theta = kp_par / kp  #cos_theta=u, theta is azimuthal angle between k' and z (line of sight) axis
    sin_theta = kp_perp / kp
    sin_gamma = kpar / k  #gamma is measured between k and xy plane, i.e. elevation of k
    cos_gamma = kperp / k
    zeta = sin_gamma * cos_theta + cos_gamma * sin_theta
    k_dot_kp = kperp * kp_perp + kpar * kp_par * zeta
    K = np.sqrt(k**2 + kp**2 - 2 * k_dot_kp)
    theta_K = kpar / K / k**2 * (
        k**2 - k_dot_kp) - kp * kperp * np.sqrt(1 - zeta**2) / k / K
    theta_kp = cos_theta
    rsd = 1. + f_zi * kpar**2 / k**2
    I = theta_kp * (theta_kp / kp**2 + theta_K / K / kp)
    integrand_1 = f_z * D_z**2 * (
        1 + z) * np.exp(-tau_z) * rsd**2 * Mps_interpf(kp) * Mps_interpf(
            K) * theta_kp**2 / kp**2
    integrand_2 = f_z * D_z**2 * (
        1 + z) * np.exp(-tau_z) * rsd**2 * Mps_interpf(kp) * Mps_interpf(
            K) * theta_kp * theta_K / kp / K
    integral_1 = const * sp.integrate.trapz(sp.integrate.trapz(
        sp.integrate.trapz(integrand_1, Kp_perp, axis=0), Kp_par, axis=0),
                                            Z,
                                            axis=0)
    integral_2 = const * sp.integrate.trapz(sp.integrate.trapz(
        sp.integrate.trapz(integrand_2, Kp_perp, axis=0), Kp_par, axis=0),
                                            Z,
                                            axis=0)
    return integral_1 + integral_2
Ejemplo n.º 6
0
def crosscorr_integral_y_rec_coords(
        ell, z_i, delta_z
):  #This is not working out-don't try this for now. Just leave it.
    n = n_points  #number of points over which to integrate
    Kp_par = np.geomspace(1.e-6, .15, n)
    Kp_perp = np.geomspace(1.e-6, 1., n)
    Z_min = z_i - delta_z
    Z_max = z_i + delta_z
    z = np.geomspace(Z_min, Z_max, n)
    Kpar = np.geomspace(1.e-6, .15, n)
    kp_perp, kp_par, kpar = np.meshgrid(Kp_perp, Kp_par, Kpar)
    chi_z = chi(z)
    T_mean_zi = uf.T_mean(z_i)
    chi_zi = chi(z_i)
    f_zi = uf.f(z_i)
    f_z = uf.f(z)
    D_zi = uf.D_1(z_i)
    r_zi = uf.r(z_i)
    D_z = uf.D_1(z)
    H_zi = uf.H(z_i)
    tau_z = uf.tau_inst(z)
    kpar = y / uf.r(z)
    const = 1.e6 / (
        8. * np.pi**3
    ) * T_rad * T_mean_zi**2 / cc.c_light_Mpc_s * f_zi * D_zi**2 * H_zi / (
        chi_zi**2) / (1. + z_i) * x * (sigma_T * rho_g0 / (mu_e * m_p))
    kperp = ell / chi_zi
    k = np.sqrt(kperp**2 + kpar**2)
    kp = np.sqrt(kp_perp**2 + kp_par**2)
    cos_theta = kp_par / kp  #cos_theta=u, theta is azimuthal angle between k' and z (line of sight) axis
    sin_theta = kp_perp / kp
    sin_gamma = kpar / k  #gamma is measured between k and xy plane, i.e. elevation of k
    cos_gamma = kperp / k
    zeta = sin_gamma * cos_theta + cos_gamma * sin_theta
    k_dot_kp = kperp * kp_perp + kpar * kp_par * zeta
    K = np.sqrt(k**2 + kp**2 - 2 * k_dot_kp)
    theta_K = kpar / K / k**2 * (
        k**2 - k_dot_kp) - kp * kperp * np.sqrt(1 - zeta**2) / k / K
    theta_kp = cos_theta
    rsd = 1. + f_zi * kpar**2 / k**2
    I = theta_kp * (theta_kp / kp**2 + theta_K / K / kp)
    z_dep_integ = sp.integrate.trapz(f_z * D_z**2 * (1 + z) * np.exp(-tau_z),
                                     z)
    integrand_1 = rsd**2 * Mps_interpf(kp) * Mps_interpf(
        K) * theta_kp**2 / kp**2 * kp_perp
    integrand_2 = rsd**2 * Mps_interpf(kp) * Mps_interpf(
        K) * theta_kp * theta_K / kp / K * kp_perp
    integral_1 = const * z_dep_integ * sp.integrate.trapz(sp.integrate.trapz(
        sp.integrate.trapz(integrand_1, Kp_perp, axis=0), Kp_par, axis=0),
                                                          Kpar,
                                                          axis=0)
    integral_2 = const * z_dep_integ * sp.integrate.trapz(sp.integrate.trapz(
        sp.integrate.trapz(integrand_2, Kp_perp, axis=0), Kp_par, axis=0),
                                                          Kpar,
                                                          axis=0)
    return integral_1 + integral_2
Ejemplo n.º 7
0
def crosscorr_squeezedlim(
    ell, z_i, y, delta_z
):  #with the assumption that zi=z so no cos factor, and we have dz=redshift bin width=2*delta_z defined above
    n = n_points  #number of points over which to integrate
    #y=np.geomspace(1.,3000.,n)
    U = np.linspace(-.9999, .9999, n)
    Kp = np.geomspace(1.e-6, .1, n)
    Z_min = z_i - delta_z
    Z_max = z_i + delta_z
    z = np.geomspace(Z_min, Z_max, n)
    u, kp = np.meshgrid(U, Kp)
    T_mean_zi = uf.T_mean(z_i)
    chi_zi = chi(z_i)
    chi_z = chi(z)
    f_zi = uf.f(z_i)
    f_z = uf.f(z)
    D_zi = uf.D_1(z_i)
    r_zi = uf.r(z_i)
    D_z = uf.D_1(z)
    H_zi = uf.H(z_i)
    tau_z = uf.tau_inst(z)
    kpar = y / uf.r(z)
    const = 1.e6 / (
        4. * np.pi**2
    ) * T_rad * T_mean_zi**2 / cc.c_light_Mpc_s * f_zi * D_zi**2 * H_zi / (
        chi_zi**2 * r_zi) / (1. + z_i) * x * (sigma_T * rho_g0 / (mu_e * m_p))
    #Cl=np.array([])
    kp_perp = kp * np.sqrt(1 - u**2)
    kp_par = kp * u
    k_perp = ell / chi_zi
    k = np.sqrt(k_perp**2 + kpar**2)
    rsd = 1. + f_zi * kpar**2 / k**2
    zeta = (kpar / k * u + k_perp / k * np.sqrt(1 - u**2))
    k_dot_kp = k_perp * kp_perp + kpar * kp_par * zeta
    K = np.sqrt(k**2 + kp**2 - 2 * k_dot_kp)
    #theta_kp=kpar*zeta/k+k_perp*np.sqrt(np.abs(1-zeta**2))/k
    theta_K = kpar / K / k**2 * (
        k**2 - k_dot_kp) - kp * k_perp * np.sqrt(1 - zeta**2) / k / K
    #print (theta_K.min(),theta_K.max())
    theta_kp = u
    #theta_K=np.where(theta_K > 0, theta_K, 0)
    I = theta_kp * (theta_kp / kp**2 + theta_K / K / kp)
    z_integral = sp.integrate.trapz(f_z * D_z**2 * (1 + z) * np.exp(-tau_z), z)
    integrand_1 = z_integral * Mps_interpf(kp) * Mps_interpf(
        K) * rsd**2 * theta_kp**2
    #+theta_K/K/kp)#-mu*kp*np.gradient(Mps_interpf(k),axis=0))
    integrand_2 = z_integral * Mps_interpf(kp) * Mps_interpf(
        k) * rsd**2 * kp**2 * theta_kp * theta_K / kp / K

    integral_sing_1 = const * sp.integrate.trapz(
        sp.integrate.trapz(integrand_1, U, axis=0), Kp, axis=0)
    integral_sing_2 = const * sp.integrate.trapz(
        sp.integrate.trapz(integrand_2, U, axis=0), Kp, axis=0)
    #Cl=np.append(Cl,integral)
    return integral_sing_1 + integral_sing_2
Ejemplo n.º 8
0
def crosscorr_squeezed_integral_y(ell, z_i, delta_z):
    n = n_points  #number of points over which to integrate
    #y=np.geomspace(1.,3000.,n)
    #Kpar=y/uf.r(z)
    Kpar = np.geomspace(1.e-6, .15, n)
    U = np.linspace(-.9999, .9999, n)
    Kp = np.geomspace(1.e-6, .1, n)
    Z_min = z_i - delta_z
    Z_max = z_i + delta_z
    z = np.geomspace(Z_min, Z_max, n)
    u, kp, kpar = np.meshgrid(U, Kp, Kpar)
    T_mean_zi = uf.T_mean(z_i)
    chi_zi = chi(z_i)
    chi_z = chi(z)
    f_zi = uf.f(z_i)
    f_z = uf.f(z)
    D_zi = uf.D_1(z_i)
    r_zi = uf.r(z_i)
    D_z = uf.D_1(z)
    H_zi = uf.H(z_i)
    tau_z = uf.tau_inst(z)
    const = 1.e6 / (
        8. * np.pi**3
    ) * T_rad * T_mean_zi**2 / cc.c_light_Mpc_s * f_zi * D_zi**2 * H_zi / (
        chi_zi**2) / (1. + z_i) * x * (sigma_T * rho_g0 / (mu_e * m_p))
    #Cl=np.array([])
    kp_perp = kp * np.sqrt(1 - u**2)
    kp_par = kp * u
    k_perp = ell / chi_zi
    k = np.sqrt(k_perp**2 + kpar**2)
    rsd = 1. + f_zi * kpar**2 / k**2
    zeta = (kpar / k * u + k_perp / k * np.sqrt(1 - u**2))
    k_dot_kp = k_perp * kp_perp + kpar * kp_par * zeta
    K = np.sqrt(k**2 + kp**2 - 2 * k_dot_kp)
    #theta_kp=kpar*zeta/k+k_perp*np.sqrt(np.abs(1-zeta**2))/k
    theta_K = kpar / K / k**2 * (
        k**2 - k_dot_kp) - kp * k_perp * np.sqrt(1 - zeta**2) / k / K
    theta_kp = u
    #theta_K=np.where(theta_K > 0, theta_K, 0)
    I = theta_kp * (theta_kp / kp**2 + theta_K / K / kp)
    z_dep_integ = sp.integrate.trapz(f_z * D_z**2 * (1 + z) * np.exp(-tau_z),
                                     z)
    integrand = Mps_interpf(kp) * Mps_interpf(
        k
    ) * rsd**2 * kp**2 * I  #+theta_K/K/kp)#-mu*kp*np.gradient(Mps_interpf(k),axis=0))
    integral_sing = const * z_dep_integ * sp.integrate.trapz(
        sp.integrate.trapz(
            sp.integrate.trapz(integrand, U, axis=0), Kp, axis=0),
        Kpar,
        axis=0)
    #Cl=np.append(Cl,integral)
    return integral_sing
Ejemplo n.º 9
0
def C_l_quad_integrand(Mu, Kp, Z, ell):
    mu, kp, z = np.meshgrid(Mu, Kp, Z)
    H_z = uf.H(z)
    chi_z = chi(z)
    #chi_Z=chi(Z)
    tau_z = uf.tau_inst(z)
    f_z = uf.f(z)
    D_z = uf.D_1(z)
    k = ell / chi_z
    K = np.sqrt(k**2 + kp**2 - 2 * k * kp * mu)
    integrand = k * (k - 2 * kp * mu) * (
        1 - mu**2) / K**2 * Mps_interpf(kp) * Mps_interpf(K) * (
            1 + z)**2 * H_z * D_z**4 * f_z**2 * np.exp(-2 * tau_z) / chi_z**2
    return integrand
Ejemplo n.º 10
0
def C_l_integrand(ell, z):
    H_z = uf.H(z)
    chi_z = chi(z)
    tau_z = uf.tau_inst(z)
    f_z = uf.f(z)
    D_z = uf.D_1(z)
    const = 1e12 * 8 * np.pi**2 * T_rad**2 * x**2 * (
        sigma_T * rho_g0 / (mu_e * m_p))**2 / cc.c_light_Mpc_s
    integrand = const * (1 + z)**2 * np.exp(
        -2 * tau_z) * chi_z * f_z**2 * H_z * D_z**4 * Delta_b_noredshift(
            ell / chi_z) / (2 * ell + 1)**3
    ##print (np.shape(integrand))
    #integrand=np.resize(integrand,(n_points+1))
    ##print (np.shape(integrand))
    return integrand
Ejemplo n.º 11
0
def C_l_mu_integral_threeints(ell, z_min):
    Kp = np.geomspace(1.e-10, 10., n_points)
    Mu = np.linspace(-0.9999, 0.9999, n_points)
    Phi = np.geomspace(1.e-4, 2 * np.pi, n_points)
    Z = np.geomspace(z_min, z_r, n_points)
    mu, phi, kp, z = np.meshgrid(Mu, Phi, Kp, Z)
    H_z = uf.H(z)
    chi_z = uf.chi(z)
    #chi_Z=chi(Z)
    tau_z = uf.tau_inst(z)
    f_z = uf.f(z)
    D_z = uf.D_1(z)
    const = 1e12 * T_rad**2 * x**2 / cc.c_light_Mpc_s * (
        sigma_T * rho_g0 / (mu_e * m_p))**2 / 16 / np.pi**3
    #kp_norm=np.linalg.norm(Kp)
    #k_norm=np.linalg.norm(ell/chi_Z)
    theta_kp_arr = np.array([])
    theta_K_arr = np.array([])
    I_arr = np.array([])
    C_l = np.array([])
    for i in ell:
        k = i / chi_z
        K = np.sqrt(k**2 + kp**2 - 2 * k * kp * mu * np.cos(phi))
        theta_kp = np.sqrt(1 - mu**2)
        theta_K = -np.sqrt(1 - mu**2) * kp / K
        theta_kp_arr = np.append(theta_kp_arr, theta_kp)
        theta_K_arr = np.append(theta_K_arr, theta_K)
        I = theta_kp**2 / kp**2 + theta_K * theta_kp / K / kp
        I_arr = np.append(I_arr, I)
        #I=k*(k-2*kp*mu)*(1-mu**2)/K**2
        integral = [
            const * sp.integrate.trapz(sp.integrate.trapz(sp.integrate.trapz(
                sp.integrate.trapz(
                    kp**2 * I * Mps_interpf(kp) * Mps_interpf(K) * (1 + z)**2 *
                    np.exp(-2 * tau_z) * f_z**2 * D_z**4 / chi_z**2 * H_z,
                    Mu,
                    axis=0),
                Phi,
                axis=0),
                                                          Kp,
                                                          axis=0),
                                       Z,
                                       axis=0)
        ]
        C_l = np.append(C_l, integral)
    return C_l, theta_kp_arr, theta_K_arr, I_arr
Ejemplo n.º 12
0
def C_l_mu_integral_squeezed(ell, z_min):
    Kp = np.geomspace(1.e-10, .1, n_points)
    Mu = np.linspace(-0.9999, 0.9999, n_points)
    Z = np.geomspace(z_min, z_r, n_points)
    mu, kp, z = np.meshgrid(Mu, Kp, Z)
    H_z = uf.H(z)
    chi_z = uf.chi(z)
    #chi_Z=chi(Z)
    tau_z = uf.tau_inst(z)
    f_z = uf.f(z)
    D_z = uf.D_1(z)
    const = 1e12 * T_rad**2 * x**2 / cc.c_light_Mpc_s * (
        sigma_T * rho_g0 / (mu_e * m_p))**2 / 8 / np.pi**2
    #kp_norm=np.linalg.norm(Kp)
    #k_norm=np.linalg.norm(ell/chi_Z)
    C_l = np.array([])
    for i in ell:
        k = i / chi_z
        #K=np.sqrt(k**2+kp**2-2*k*kp*mu)  #original K
        K = np.sqrt(k**2 + kp**2 - 2 * k * kp *
                    (np.sqrt(1 - mu**2)))  #changed K, correct one
        #I=(1-mu**2) #in squeezed with original
        #I=k*(k-2*kp*mu)*(1-mu**2)/K**2 #original I, without squeezed
        #I=k*(k-2*kp*np.sqrt(1-mu**2))*(mu**2)/K**2 #I, without squeezed, changed, correct one
        I = mu**2  #I, with squeezed, changed, correct one
        integral = [
            const * sp.integrate.trapz(sp.integrate.trapz(sp.integrate.trapz(
                I * Mps_interpf(kp) * Mps_interpf(k) * (1 + z)**2 *
                np.exp(-2 * tau_z) * f_z**2 * D_z**4 / chi_z**2 * H_z,
                Mu,
                axis=0),
                                                          Kp,
                                                          axis=0),
                                       Z,
                                       axis=0)
        ]
        C_l = np.append(C_l, integral)
    return C_l
Ejemplo n.º 13
0
def crosscorr_squeezedlim(ell,
                          y):  #with the assumption that zi=z so no cos factor
    z_i = 1.
    delta_z = 0.3
    n = 100
    Mu = np.linspace(-0.9999, 0.9999, n)
    Kp = np.linspace(1.e-4, 10., n)
    mu, kp = np.meshgrid(Mu, Kp)
    z = z_i
    T_mean_zi = uf.T_mean(z_i)
    chi_zi = chi(z_i)
    chi_z = chi(z)
    f_zi = uf.f(z_i)
    f_z = uf.f(z)
    D_zi = uf.D_1(z_i)
    r_zi = uf.r(z_i)
    D_z = uf.D_1(z)
    H_zi = uf.H(z_i)
    tau_z = uf.tau_inst(z)
    const = 1.e6 / (
        2. * np.pi
    )**2 * T_rad * T_mean_zi / cc.c_light_Mpc_s * f_zi * D_zi**2 * H_zi / (
        chi_zi**2 * r_zi) / (1. + z_i) * x * (
            sigma_T * rho_g0 /
            (mu_e * m_p)) * delta_z * f_z * D_z**2 * (1 + z) * np.exp(-tau_z)
    #Cl=np.array([])
    kpar = y / r_zi
    k_perp = ell / chi_zi
    k = np.sqrt(k_perp**2 + kpar**2)
    rsd = 1. + f_zi * kpar**2 / k**2
    theta_kp = kpar * mu / k + k_perp * np.sqrt(1. - mu**2) / k
    integrand = Mps_interpf(kp) * rsd * theta_kp**2 * (
        Mps_interpf(k))  #-mu*kp*np.gradient(Mps_interpf(k),axis=0))
    integral_sing = const * sp.integrate.trapz(
        sp.integrate.trapz(integrand, Mu, axis=0), Kp, axis=0)
    #Cl=np.append(Cl,integral)
    return integral_sing