def bulge_M2d(R): return sersic.M2d(R, nser, reff * arcsec2kpc)
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 lmchab_samp_here = skewnorm.rvs(10.**mchab_logskew, mchab_mu, mchab_sig, nint) lmchab_samp.append(lmchab_samp_here) lm200_samp.append(np.random.normal(0., 1., nint)) lc200_samp.append(np.random.normal(0., 1., nint)) laimf_samp.append(np.random.normal(0., 1., nint)) grid_file = h5py.File('grids/%s_tein_crosssect_grid.hdf5' % name, 'r') lmstar_grid = grid_file['lmstar_grid'].value.copy() nmstar = len(lmstar_grid) lm200_grid = grid_file['lm200_grid'].value.copy()
def get_source_gammat(self): self.sources['gammat'] = (self.S_h/np.pi/(self.sources['r']/self.rs_ang)**2*adcontr.M2d(self.sources['r'], self.fbar, self.reff_ang, self.rs_ang, self.c200, self.nu) + \ -self.S_h*adcontr.Sigma(self.sources['r'], self.fbar, self.reff_ang, self.rs_ang, self.c200, self.nu) + \ self.S_bulge*(sersic.M2d(self.sources['r'], self.nser, self.reff_ang)/(self.sources['r']/self.reff_ang)**2/pi - \ sersic.Sigma(self.sources['r']/self.reff_ang, self.nser, 1.))) / self.sources['s_cr']
f.close() griddir = 'grids/' line = lines[lensno + 1].split() name = line[0] zd = float(line[1]) zs = float(line[2]) rein = float(line[3]) # Einstein radius in arcseconds reff = float(line[4]) nser = float(line[5]) # defines the stellar profile ein_frac = sersic.M2d(rein, nser, reff) 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)
def Sigmabar(self, theta): return (4.*self.S_s*nfw.gfunc(theta/self.rs_ang)/(theta/self.rs_ang)**2 + \ self.S_bulge*(sersic.M2d(theta, self.nser, self.reff_ang)/(theta/self.reff_ang)**2/pi)) /1e12
def alpha(self, theta, z): return (4.*self.S_s*theta/(theta/self.rs_ang)**2*nfw.gfunc(theta/self.rs_ang) + \ self.S_bulge/pi*theta/(theta/self.reff_ang)**2*sersic.M2d(theta, self.nser, self.reff_ang)) / self.S_cr(z)
def gammat(self, theta, z): return (2.*self.S_s*(2.*nfw.gfunc(theta/self.rs_ang)/(theta/self.rs_ang)**2 - nfw.Ffunc(theta/self.rs_ang)) + \ self.S_bulge*(sersic.M2d(theta, self.nser, self.reff_ang)/(theta/self.reff_ang)**2/pi - \ sersic.Sigma(theta/self.reff_ang, self.nser, 1.))) / self.S_cr(z)
def get_source_gammat(self): self.sources['gammat'] = (2.*self.S_s*(2.*nfw.gfunc(self.sources['r']/self.rs_ang)/(self.sources['r']/self.rs_ang)**2 + \ - nfw.Ffunc(self.sources['r']/self.rs_ang)) + \ self.S_bulge*(sersic.M2d(self.sources['r'], self.nser, self.reff_ang)/(self.sources['r']/self.reff_ang)**2/pi - \ sersic.Sigma(self.sources['r']/self.reff_ang, self.nser, 1.))) / self.sources['s_cr']
def alpha(x): # deflection angle (in kpc) return (10.**lm200_samp[i] / nfw.M3d(r200, rs) * nfw.M2d(x, rs) + 10.**lmstar * sersic.M2d(x, nser, reff)) / np.pi / x / s_cr