示例#1
0
def delta_to_Sigma(delta,zrange,cosmo=None):
    Sigma = delta.copy()
    assert len(zrange) == delta.Nz
    if cosmo is None: cosmo = Cosmology()
    zrange = list(zrange) + [0.0]
    for i in range(Sigma.Nz):
        lp = Sigma.lens_plane(i)
        z = zrange[i]
        #lp += 1
        lp  *= cosmo.H0**2 * cosmo.Om * cosmo.rho_crit(z)*(1.+z)**3 \
               /cosmo.H(z)**2

        #now we're in g/cm^3
        lp *= Mpc_cm**3 / Msun_g

        #multiply by size of bin to get surface density
        lp *= ( cosmo.Dc(zrange[i]) - cosmo.Dc(zrange[i-1]) )
    return Sigma
示例#2
0
def Sigma_to_delta(Sigma,zrange,cosmo=None):
    delta = Sigma.copy()
    assert len(zrange) == Sigma.Nz
    if cosmo is None: cosmo = Cosmology(Or=0.0)
    zrange = list(zrange) + [0.0]
    for i in range(delta.Nz):
        lp = delta.lens_plane(i)
        z = zrange[i]
        
        #divide by bin size to turn surface density into 3D density
        lp /= ( cosmo.Dc(zrange[i]) - cosmo.Dc(zrange[i-1]) )

        #convert to g/cm^3
        lp *= Msun_g / Mpc_cm**3

        lp /= cosmo.H0**2 * cosmo.Om * cosmo.rho_crit(z)*(1.+z)**3 \
               /cosmo.H(z)**2

        #i = numpy.where(lp.real>0)
        #lp[i] -= 1
        
    return delta