def __init__(self, z=0.3, m200=1e13, c200=5., mstar=1e11, reff=5., ra=0., dec=0., sources=None, \
                 cosmo=wl_cosmology.default_cosmo):


        self.z = z
        self.cosmo = cosmo
        self.m200 = m200 # halo mass in M_Sun units
        self.mstar = mstar # stellar mass in M_Sun units
        self.rhocrit = wl_cosmology.rhoc(self.z, cosmo=self.cosmo)
        self.r200 = (self.m200*3./200./(4.*pi)/self.rhocrit)**(1/3.) #r200 in Mpc
        self.c200 = c200
        self.rs = self.r200/self.c200
        self.reff = reff # effective radius in kpc
        self.angD = wl_cosmology.Dang(self.z, cosmo=self.cosmo)
        self.Mpc2deg = np.rad2deg(1./self.angD)
        self.rs_ang = self.rs*self.Mpc2deg
        self.reff_ang = self.reff*self.Mpc2deg/1000.
        self.S_s = self.m200/(np.log(1. + self.c200) - self.c200/(1. + self.c200))/(4.*pi*self.rs**2)
        self.S_bulge = self.mstar/self.reff**2*1e6
        self.sources = sources

        if ra is not None:
            self.ra = ra
        if dec is not None:
            self.dec = dec
    def __init__(self, z=0.3, m200=1e13, c200=5., gammadm=1., mstar=1e11, reff=5., ra=0., dec=0., sources=None, \
                 cosmo=wl_cosmology.default_cosmo):

        self.z = z
        self.cosmo = cosmo
        self.m200 = m200  # halo mass in M_Sun units
        self.mstar = mstar  # central point mass in M_Sun units
        self.rhocrit = wl_cosmology.rhoc(self.z, cosmo=self.cosmo)
        self.r200 = (self.m200 * 3. / 200. / (4. * pi) / self.rhocrit)**(
            1 / 3.)  #r200 in Mpc
        self.c200 = c200
        self.rs = self.r200 / self.c200
        self.reff = reff  # effective radius in kpc
        self.gammadm = gammadm
        self.angD = wl_cosmology.Dang(self.z, cosmo=self.cosmo)
        self.Mpc2deg = np.rad2deg(1. / self.angD)
        self.rs_ang = self.rs * self.Mpc2deg
        self.reff_ang = self.reff * self.Mpc2deg / 1000.
        self.halo_norm = self.m200 / gnfw.fast_M3d(self.r200, self.rs,
                                                   self.gammadm)
        self.S_bulge = self.mstar / self.reff**2 * 1e6
        self.sources = sources

        if ra is not None:
            self.ra = ra
        if dec is not None:
            self.dec = dec
    def __init__(self, z=0.3, m200=1e13, c200=5., mstar=1e11, reff=5., nser=4., nu=0., ra=0., dec=0., sources=None, \
                 cosmo=wl_cosmology.default_cosmo):

        import adcontr

        self.z = z
        self.cosmo = cosmo
        self.m200 = m200  # halo mass in M_Sun units
        self.mstar = mstar  # stellar mass in M_Sun units
        self.fbar = self.mstar / (self.mstar + self.m200)
        self.rhocrit = wl_cosmology.rhoc(self.z, cosmo=self.cosmo)
        self.r200 = (self.m200 * 3. / 200. / (4. * pi) / self.rhocrit)**(
            1 / 3.)  #r200 in Mpc
        self.c200 = c200
        self.rs = self.r200 / self.c200
        self.reff = reff  # effective radius in kpc
        self.nser = nser  # Sersic index
        self.nu = nu  # adiabatic contraction efficiency parameter
        self.angD = wl_cosmology.Dang(self.z, cosmo=self.cosmo)
        self.Mpc2deg = np.rad2deg(1. / self.angD)
        self.rs_ang = self.rs * self.Mpc2deg
        self.reff_ang = self.reff * self.Mpc2deg / 1000.
        self.S_h = self.m200 / self.rs**2
        self.S_bulge = self.mstar / self.reff**2 * 1e6
        self.sources = sources

        if ra is not None:
            self.ra = ra
        if dec is not None:
            self.dec = dec
    def __init__(self, z=0.3, m200=1e13, c200=5., mstar=1e11, ra=0., dec=0., sources=None, \
                 cosmo=wl_cosmology.default_cosmo):

        self.z = z
        self.cosmo = cosmo
        self.m200 = m200 # halo mass in M_Sun units
        self.mstar = mstar # central point mass in M_Sun units
        self.rhocrit = wl_cosmology.rhoc(self.z, cosmo=self.cosmo)
        self.r200 = (self.m200*3./200./(4.*pi)/self.rhocrit)**(1/3.) #r200 in Mpc
        self.c200 = c200
        self.rs = self.r200/self.c200
        self.angD = wl_cosmology.Dang(self.z, cosmo=self.cosmo)
        self.Mpc2deg = np.rad2deg(1./self.angD)
        self.rs_ang = self.rs*self.Mpc2deg
        self.S_s = self.m200/(np.log(1. + self.c200) - self.c200/(1. + self.c200))/(4.*pi*self.rs**2)
        self.sources = sources

        if ra is not None:
            self.ra = ra
        if dec is not None:
            self.dec = dec
    def __init__(self, z=0.3, m200=1e13, c200=5., alpha=1., mstar=1e11, ra=0., dec=0., sources=None, \
                 cosmo=wl_cosmology.default_cosmo):

        self.z = z
        self.cosmo = cosmo
        self.m200 = m200 # halo mass in M_Sun units
        self.mstar = mstar # central point mass in M_Sun units
        self.rhocrit = wl_cosmology.rhoc(self.z, cosmo=self.cosmo)
        self.r200 = (self.m200*3./200./(4.*pi)/self.rhocrit)**(1/3.) #r200 in Mpc
        self.c200 = c200
        self.r2 = self.r200/self.c200
        self.alpha = alpha
        self.angD = wl_cosmology.Dang(self.z, cosmo=self.cosmo)
        self.Mpc2deg = np.rad2deg(1./self.angD)
        self.r2_ang = self.r2*self.Mpc2deg
        self.halo_norm = self.m200/einasto.M3d(self.r200, self.r2, self.alpha)
        self.sources = sources

        if ra is not None:
            self.ra = ra
        if dec is not None:
            self.dec = dec
    zs_here = float(line[2])
    zs.append(zs_here)

    tein_here = float(line[3])
    tein_obs.append(tein_here)
    tein_err.append(0.1 * tein_here)

    lmchab_obs.append(float(line[6]))
    lmchab_err.append(float(line[7]))

    dd = wl_cosmology.Dang(zd)
    ds = wl_cosmology.Dang(zs_here)
    dds = wl_cosmology.Dang(zs_here, zd)

    arcsec2kpc = np.deg2rad(1. / 3600.) * dd * 1000.
    rhoc.append(wl_cosmology.rhoc(zd))

    rein_phys_here = tein_here * arcsec2kpc
    rein_phys.append(rein_phys_here)

    s_cr = c**2 / (4. * np.pi * G) * ds / dds / dd / Mpc / M_Sun * kpc**2

    mein_here = np.pi * rein_phys_here**2 * s_cr

    reff1 = float(line[4])
    nser1 = float(line[5])

    # defines the stellar profile
    ein_frac.append(sersic.M2d(tein_here, nser1, reff1))

    # draws a sample of values of lmchab, to be used for importance sampling and MC integration
def bulge_M2d(R):
    return sersic.M2d(R, nser, reff * arcsec2kpc)


def bulge_Sigma(R):
    return sersic.Sigma(R, nser, reff * arcsec2kpc)


lmchab_obs = float(line[6])
lmchab_err = float(line[7])

dd = wl_cosmology.Dang(zd)
ds = wl_cosmology.Dang(zs)
dds = wl_cosmology.Dang(zs, zd)

rhoc = wl_cosmology.rhoc(
    zd)  # critical density of the Universe in M_Sun/Mpc**3

s_cr = c**2 / (
    4. * np.pi * G
) * ds / dds / dd / Mpc / M_Sun * kpc**2  # critical surface mass density in M_Sun/kpc**2

arcsec2kpc = arcsec2rad * dd * 1000.
rein_phys = rein * arcsec2kpc  # Einstein radius in kpc

nm200 = 30
nmstar = 30
nc200 = 5

# defines the grid
lmstar_min = lmchab_obs - 0.5
lmstar_max = lmchab_obs + 0.5
def radius_NFW(M200, redshift=0.):  # R200 radius in kpc
    mean_density = 200. * wl_cosmology.rhoc(redshift, cosmo=default_cosmo)
    return (3. / 4. / np.pi * M200 / mean_density)**(1. / 3.) * 1000.
Exemple #9
0
lmsps_piv = 11.5 # pivot point of stellar mass-halo mass and stellar mass-size relation
lmsps_err = 0.15 # uncertainty on logM* from stellar population synthesis

zd = 0.2 # lens redshift
zs = 1. # source redshift
c200 = 5. # halo concentration

kpc = Mpc/1000.
arcsec2rad = np.deg2rad(1./3600.)

dd = wl_cosmology.Dang(zd)
ds = wl_cosmology.Dang(zs)
dds = wl_cosmology.Dang(zs, zd)

rhoc = wl_cosmology.rhoc(zd) # critical density of the Universe at z=zd. Halo masses are defined as M200 wrt rhoc.

arcsec2kpc = arcsec2rad * dd * 1000.

# source distribution parameters
sigma_eps = 0.25 # intrinsic scatter in shape distribution
nbkg = 25. # source number density (in arcmin^-2)
Rmin_Mpc = 0.03 # minimum radius for shape measurements (in Mpc)
Rmax_Mpc = 0.3 # maximum radius for shape measurements (in Mpc)

Rmin_deg = np.rad2deg(Rmin_Mpc/dd)
Rmax_deg = np.rad2deg(Rmax_Mpc/dd)

nsource_avg = nbkg * np.pi * (Rmax_deg**2 - Rmin_deg**2) * 3600. # average number of sources per lens

Rfrac_min = gnfw.R_grid[0] # lower bound of R in gNFW profile grids, in units of r_s