#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 cc = ClusterCosmology(lmax=8500,pickling=True) widtharc = 50. px = 0.5 shape,wcs = enmap.get_enmap_patch(widtharc,px) modrmap = enmap.modrmap(shape,wcs) modlmap = enmap.modlmap(shape,wcs) rbins = np.arange(0.,10.,1.0) rbinner = stats.bin2D(modrmap*60.*180./np.pi,rbins) true_mass = 2.e14 true2d = get_nfw(true_mass) kellmin = 200 kellmax = 8500 true2d = enmap.ndmap(fmaps.filter_map(true2d,true2d*0.+1.,modlmap,lowPass=kellmax,highPass=kellmin),wcs) Nsims = 1000 cov = np.ones((1,1,8500))*0.00000001 ngen = enmap.MapGen(shape,wcs,cov)
Nsims = 10 beam_arcmin = 1.0 noise_T_uK_arcmin = 0.01 noise_P_uK_arcmin = 0.01 # beam_arcmin = 0. # noise_T_uK_arcmin = 0. # noise_P_uK_arcmin = 0. pol_list = ['TT', 'EB'] #,'EE','ET','TE','TB'] pol = False if pol_list == ['TT'] else True shape_sim, wcs_sim = enmap.get_enmap_patch(patch_width_arcmin, sim_pixel_scale, proj="car", pol=pol) modr_sim = enmap.modrmap(shape_sim, wcs_sim) * 180. * 60. / np.pi # === COSMOLOGY === cc = ClusterCosmology(lmax=lmax, pickling=True) #,fill_zero=False) TCMB = 2.7255e6 theory = cc.theory # === EXPERIMENT === lxmap_sim, lymap_sim, modlmap_sim, angmap_sim, lx_sim, ly_sim = fmaps.get_ft_attributes_enmap( shape_sim, wcs_sim) pix_ells = np.arange(0, modlmap_sim.max(), 1) ntfunc = lambda x: modlmap_dat * 0. + (np.pi / (180. * 60) )**2. * noise_T_uK_arcmin**2. / TCMB**2.
from orphics.theory.cosmology import Cosmology import orphics.tools.stats as stats import numpy as np import orphics.tools.io as io from enlib import enmap # let's define the bin edges for this test ellmin = 2 ellmax = 4000 bin_width = 200 bin_edges = np.arange(ellmin, ellmax, bin_width) # a typical map might be 400sq.deg. with 0.5 arcmin pixels shape, wcs = enmap.get_enmap_patch(width_arcmin=20 * 60., px_res_arcmin=0.5) # let's get the "mod ell" or |ell| map, which tells us the magnitude of # the angular wavenumbers in each fourier pixel modlmap = enmap.modlmap(shape, wcs) # this let's us create a 2D fourier space binner binner2d = stats.bin2D(modlmap, bin_edges) # the 1d binner just needs to know about the bin edges binner1d = stats.bin1D(bin_edges) # initialize a cosmology; make sure you have an "output" directory # for pickling to work cc = Cosmology(lmax=6000, pickling=True) theory = cc.theory # the fine ells we will use
# noiseless beam = 0. noiseT = 0. # cosmology cc = Cosmology(lmax=lmax_global, pickling=True) #,dimensionless=False) theory = cc.theory ellrange = np.arange(0, lmax_global, 1) clkk = theory.gCl('kk', ellrange) lcltt = theory.lCl('TT', ellrange) ucltt = theory.uCl('TT', ellrange) # quadratic estimator deg = 5. px = 0.5 shape, wcs = enmap.get_enmap_patch(deg * 60., px, proj="car", pol=False) template = fmaps.simple_flipper_template_from_enmap(shape, wcs) lxmap_dat, lymap_dat, modlmap_dat, angmap_dat, lx_dat, ly_dat = fmaps.get_ft_attributes_enmap( shape, wcs) lbin_edges = np.arange(kellmin, kellmax, 200) lbinner_dat = stats.bin2D(modlmap_dat, lbin_edges) fmask = fmaps.fourierMask(lx_dat, ly_dat, modlmap_dat, lmin=kellmin, lmax=kellmax) nlgen = qe.NlGenerator(template, theory) nTX, nPX, nTY, nPY = nlgen.updateNoise(beamX=beam, noiseTX=noiseT, noisePX=0., tellminX=tellmin,
return sgn*kappa from alhazen.maxlike import lnlike out_dir = os.environ['WWW']+"plots/maxlike_hdv_nodim_" lmax = 8000 cc = ClusterCosmology(lmax=lmax,pickling=True) theory = cc.theory arc = 10.0 px = 0.5 lens_order = 5 shape,wcs = enmap.get_enmap_patch(arc,px,proj="car") noise_T = 1.0 pa = fmaps.PatchArray(shape,wcs,dimensionless=False,skip_real=False) pa.add_theory(cc,theory,lmax) pa.add_gaussian_beam(1.0) pa.add_white_noise_with_atm(noise_T,0.,0,1,0,1) Npoints = 60 mrange = np.linspace(1,3,Npoints)*1.e14 trueM = 2e14 kappa = nfwkappa(trueM)
import numpy as np out_dir = "" lmax = 2000 cc = ClusterCosmology(lmax=lmax, pickling=True) TCMB = 2.7255e6 theory = cc.theory ps = cmb.enmap_power_from_orphics_theory(theory, lmax, lensed=False) cov = ps width_deg = 20. pix = 2.0 shape, wcs = enmap.get_enmap_patch(width_deg * 60., pix, proj="CAR", pol=True) m1 = enmap.rand_map(shape, wcs, cov, scalar=True, seed=None, power2d=False, pixel_units=False) modlmap = m1.modlmap() io.quickPlot2d(m1[0], out_dir + "m1.png") cltt = ps[0, 0] ells = np.arange(0, cltt.size) pl = io.Plotter(scaleY='log') pl.add(ells, cltt * ells**2.)