def nfwkappa(massOverh): sgn = 1. if massOverh>0. else -1. zL = 0.7 overdensity = 180. critical = False atClusterZ = False concentration = 3.2 comS = cc.results.comoving_radial_distance(cc.cmbZ)*cc.h comL = cc.results.comoving_radial_distance(zL)*cc.h winAtLens = (comS-comL)/comS kappa,r500 = NFWkappa(cc,np.abs(massOverh),concentration,zL,pa.modrmap* 180.*60./np.pi,winAtLens, overdensity=overdensity,critical=critical,atClusterZ=atClusterZ) return sgn*kappa
def get_nfw(massOverh,zL=0.7,concentration=3.2): from alhazen.halos import NFWkappa #massOverh = 2.e14 overdensity = 180. critical = False atClusterZ = False comS = cc.results.comoving_radial_distance(cc.cmbZ)*cc.h comL = cc.results.comoving_radial_distance(zL)*cc.h winAtLens = (comS-comL)/comS kappa,r500 = NFWkappa(cc,massOverh,concentration,zL,modrmap* 180.*60./np.pi,winAtLens, overdensity=overdensity,critical=critical,atClusterZ=atClusterZ) return kappa
def nfw_kappa_from_config(Config, kappa_section, cc, modrmap_radians): from alhazen.halos import NFWkappa massOverh = Config.getfloat(kappa_section, "massOverh") zL = Config.getfloat(kappa_section, "zL") overdensity = Config.getfloat(kappa_section, "overdensity") critical = Config.getboolean(kappa_section, "critical") atClusterZ = Config.getboolean(kappa_section, "atClusterZ") concentration = Config.getfloat(kappa_section, "concentration") comS = cc.results.comoving_radial_distance(cc.cmbZ) * cc.h comL = cc.results.comoving_radial_distance(zL) * cc.h winAtLens = (comS - comL) / comS kappa, r500 = NFWkappa(cc, massOverh, concentration, zL, modrmap_radians * 180. * 60. / np.pi, winAtLens, overdensity=overdensity, critical=critical, atClusterZ=atClusterZ) return kappa
if cluster: grad_cut = 2000 massOverh = 2.e14 zL = 0.7 overdensity = 500. critical = True atClusterZ = True concentration = 3.2 comS = cc.results.comoving_radial_distance(cc.cmbZ) * cc.h comL = cc.results.comoving_radial_distance(zL) * cc.h winAtLens = (comS - comL) / comS kappa_map, r500 = NFWkappa(cc, massOverh, concentration, zL, modr_sim, winAtLens, overdensity=overdensity, critical=critical, atClusterZ=atClusterZ) else: grad_cut = None clkk = theory.gCl("kk", fine_ells) clkk.resize((1, 1, clkk.size)) kappa_map = enmap.rand_map(shape_sim[-2:], wcs_sim, cov=clkk, scalar=True) pkk = fmaps.get_simple_power_enmap(kappa_map) debug_edges = np.arange(2, 12000, 80) dbinner = stats.bin2D(modlmap_sim, debug_edges) cents, bclkk = dbinner.bin(pkk)
pxDown = 0.2 deg = utils.degree arcmin = utils.arcmin shape, wcs = enmap.geometry(pos=[[-hwidth*arcmin,-hwidth*arcmin],[hwidth*arcmin,hwidth*arcmin]], res=px*arcmin, proj="car") shapeDown, wcsDown = enmap.geometry(pos=[[-hwidth*arcmin,-hwidth*arcmin],[hwidth*arcmin,hwidth*arcmin]], res=pxDown*arcmin, proj="car") thetaMap = enmap.posmap(shape, wcs) thetaMap = np.sum(thetaMap**2,0)**0.5 thetaMapDown = enmap.posmap(shapeDown, wcsDown) thetaMapDown = np.sum(thetaMapDown**2,0)**0.5 comL = cc.results.comoving_radial_distance(zL)*cc.h comS = cc.results.comoving_radial_distance(sourceZ)*cc.h winAtLens = (comS-comL)/comS kappaMap,r500 = NFWkappa(cc,massOverh,concentration,zL,thetaMap*180.*60./np.pi,winAtLens,overdensity=overdensity,critical=critical,atClusterZ=atClusterZ) # === CMB POWER SPECTRUM === ps = powspec.read_spectrum("data/cl_lensinput.dat") # === DEFLECTION MAP === a = alphaMaker(thetaMap) alpha = a.kappaToAlpha(kappaMap,test=False) pos = thetaMap.posmap() + alpha pix = thetaMap.sky2pix(pos, safe=False) gradfit = 2.*np.pi/180./60. from scipy.ndimage.interpolation import rotate
if cluster: massOverh = 2.e14 zL = 0.7 overdensity = 500. critical = True atClusterZ = True concentration = 3.2 comS = cc.results.comoving_radial_distance(cc.cmbZ) * cc.h comL = cc.results.comoving_radial_distance(zL) * cc.h winAtLens = (comS - comL) / comS kappa_map, r500 = NFWkappa(cc, massOverh, concentration, zL, modr_sim, winAtLens, overdensity=overdensity, critical=critical, atClusterZ=atClusterZ) #cents, nkprofile = binner.bin(kappa_map) model_mass = 2.e14 model_uniform_kappa = 0.02 #02 else: clkk = theory.gCl("kk", fine_ells) clkk.resize((1, 1, clkk.size)) kappa_map = enmap.rand_map(shape_sim[-2:], wcs_sim, cov=clkk, scalar=True) if debug: pkk = fmaps.get_simple_power_enmap(kappa_map) debug_edges = np.arange(kellmin, 8000, 80)
from alhazen.halos import NFWkappa massOverh = 2.e14 zL = 0.7 overdensity = 180. critical = False atClusterZ = False concentration = 3.2 comS = cc.results.comoving_radial_distance(cc.cmbZ) * cc.h comL = cc.results.comoving_radial_distance(zL) * cc.h winAtLens = (comS - comL) / comS kappa, r500 = NFWkappa(cc, massOverh, concentration, zL, parray_sim.modrmap * 180. * 60. / np.pi, winAtLens, overdensity=overdensity, critical=critical, atClusterZ=atClusterZ) else: kappa = parray_sim.get_kappa(ktype="grf", vary=False) if simulated_cmb: phi, fphi = lt.kappa_to_phi(kappa, parray_sim.modlmap, return_fphi=True) #alpha_pix = enmap.grad_pixf(fphi) grad_phi = enmap.grad(phi)