Пример #1
0
    seed = (0,0,task+sindex)

    # If debugging, get unfiltered maps and plot Cls
    if task==0 and debug_cmb:
        t_alm,e_alm,b_alm = solint.get_kmap(channel,seed,lmin,lmax,filtered=False)
        tcl = hp.alm2cl(t_alm)
        ls = np.arange(tcl.size)
        pl = io.Plotter('Cell')
        pl.add(ls,tcl/w2)
        ls2,nells,nells_P = solint.get_noise_power(channel,beam_deconv=True)
        theory = cosmology.default_theory()
        pl.add(ls,theory.lCl('TT',ls) + maps.interp(ls2,nells)(ls),color='k')
        pl._ax.set_xlim(1,6000)
        pl._ax.set_ylim(1e-6,1e3)
        pl.done(f'{solenspipe.opath}/tcl.png')
        imap = enmap.downgrade(solint.alm2map(np.asarray([t_alm,e_alm,b_alm]),ncomp=3) * maps.binary_mask(mask),2)
        for i in range(3): io.hplot(imap[i],f'{solenspipe.opath}/imap_{i}',mask=0)


    with bench.show("sim"):
        # Get simulated, prepared filtered T, E, B maps, i.e. (1/(C+N) * teb_alm)
        t_alm,e_alm,b_alm = solint.get_kmap(channel,seed,lmin,lmax,filtered=True)
        # Get the reconstructed kappa map alms and filter it with the normalization
        recon_alms = qe.filter_alms(solint.get_mv_kappa(polcomb,t_alm,e_alm,b_alm),maps.interp(Als['L'],Als[polcomb]))
    
    # Subtract a meanfield if necessary
    recon_alms = recon_alms - mf_alm

    if task==0 and debug_cmb:
        rmap = solint.alm2map(recon_alms,ncomp=1)[0] * maps.binary_mask(mask)
        io.hplot(rmap,f'{solenspipe.opath}/rmap',mask=0,color='gray')
Пример #2
0
        mask = enmap.read_map(
            tutils.get_generic_fname(tdir,
                                     region,
                                     solution,
                                     deproject=deproject,
                                     data_comb=dcomb,
                                     version="v1.1.1",
                                     sim_index=None,
                                     mask=True))

        malm = cs.map2alm(mask, lmax=lmax)
        ialm = cs.map2alm(imap, lmax=lmax)

        malm = malm.astype(np.complex128, copy=False)
        malm = rotate_alm(malm, 2000.0, 2000.0, 'C', 'G')

        ialm = ialm.astype(np.complex128, copy=False)
        ialm = rotate_alm(ialm, 2000.0, 2000.0, 'C', 'G')

        imask = maps.binary_mask(hp.alm2map(malm, nside))
        hmap = hmap + hp.alm2map(ialm, nside) * imask
        hmask = hmask + imask

    io.mollview(hmap, f'{froot}test_rot_{deproject}.png')
    io.mollview(hmask, f'{froot}test_rot_mask_{deproject}.png')

    hp.write_map(f'{froot}test_rot_{deproject}.fits', hmap, overwrite=True)
    hp.write_map(f'{froot}test_rot_mask_{deproject}.fits',
                 hmask,
                 overwrite=True)
Пример #3
0
lc = cosmology.LimberCosmology(skipCls=True,pickling=False,numz=1000,kmax=1.47,nonlinear=True,skipPower=False,zmax=1100.,low_acc=True,skip_growth=True)
lc.addStepNz("g",0.4,0.7,bias=2.0)
#lc.addStepNz("g",0.2,0.9,bias=1.6)
lc.generateCls(ells )
clkk = lc.getCl("cmb","cmb")
clkg = lc.getCl("cmb","g")
clgg = lc.getCl("g","g")

#theory = cosmology.default_theory()
#clkk = theory.gCl('kk',ells)

ledges = np.arange(80,1000,40)

for region in ['deep56','boss']:
    dmask = sints.get_act_mr3_crosslinked_mask(region=region)
    bmask = maps.binary_mask(dmask,0.95)
    fsky = dmask.area()/np.pi/4. * (bmask.sum()/bmask.size)

    pl = io.Plotter(xyscale='linlog',xlabel='l',ylabel='C')
    pl.add(ells,clkk)
    ls,nls = np.loadtxt("lensing_noise_act_planck_ilc_all_%s.txt" % region,unpack=True)
    pl.add(ls,nls)
    oells,onls = np.loadtxt("cl_K_ilc_noszK_ilc_noszs14&15_%s.txt" % region , unpack=True,usecols=[0,1])
    pl.add(oells,onls-maps.interp(ells,clkk)(oells),ls='--')
    pl.done("lensnoise_%s.png" % region)

    lf = cosmology.LensForecast()
    lf.loadKK(ells,clkk,ls,nls)
    lf.loadKG(ells,clkg)
    lf.loadGG(ells,clgg,ngal=0.026)
    #lf.loadGG(ells,clgg,ngal=0.1)
Пример #4
0
"""
Loads a catalog
Maps it
Smooths it
Thresholds it
Projects it onto ACT
This gives a mask of 1s and 0s from which a random catalog can be made
"""


paths = cutils.paths
#cat_type = "wise_panstarrs"
#cat_type = "madcows_photz"
cat_type = args.sys[1]
meanfield = False

# cat_type = "sdss_redmapper"
# meanfield = True

shape,wcs = enmap.fullsky_geometry(res=1 * utils.degree)
ras,decs,_ = cutils.catalog_interface(cat_type,is_meanfield=meanfield)
cmapper = catalogs.CatMapper(ras,decs,shape=shape,wcs=wcs)
cmap = maps.binary_mask(enmap.smooth_gauss(cmapper.counts,2 * utils.degree),1e-3)
io.hplot(cmap,'counts')


shape,wcs = enmap.read_map_geometry(paths.coadd_data + f"act_planck_s08_s18_cmb_f150_daynight_srcfree_map.fits")
omap = enmap.project(cmap,shape,wcs,order=0)
io.plot_img(omap,'pcounts')
enmap.write_map(f'{paths.scratch}{cat_type}_mask.fits',omap)
Пример #5
0
    freqs = []
    for i in range(narrays):
        f = config.darrays[arrays[i]]['freq']
        freqs.append(f)
    shape, wcs = config.shape, config.wcs
    Ny, Nx = shape[-2:]
    fc = config.fc
    modlmap = config.modlmap
    lmax = 5000

    icinv = np.load("%sicinv.npy" % croot)
    Cinv = np.rollaxis(icinv, 0, 3)
    ikmaps, _ = config.get_coadds()
    ikmaps[:, modlmap > 5000] = 0
    kmaps = ikmaps.reshape((narrays, Ny * Nx))[:, modlmap.reshape(-1) < lmax]
    bmask = maps.binary_mask(enmap.read_map(config.xmaskfname()))

    yresponses = fg.gnu(freqs, tcmb=2.7255)
    cresponses = yresponses * 0. + 1.

    iksilc = maps.silc(kmaps, Cinv, yresponses)  # ILC HAPPENS HERE
    cents, psilc_y = process(iksilc, "silc_y", y=True, ellmax=3000)

    iksilc = maps.cilc(kmaps, Cinv, yresponses, cresponses)  # ILC HAPPENS HERE
    cents, pcilc_y = process(iksilc,
                             "cilc_y_deproj_cmb_lmax_3000",
                             ellmax=3000,
                             y=True)

    pl2.add(cents,
            psilc_y * cents**2.,
Пример #6
0
        version, region, region, version)

    sname = "/scratch/r/rbond/msyriac/data/depot/tilec/v1.2.0_20200324//%s_%s/tilec_single_tile_%s_cmb_%s.fits" % (
        version, region, region, version)
    sbname = "/scratch/r/rbond/msyriac/data/depot/tilec/v1.2.0_20200324//%s_%s/tilec_single_tile_%s_cmb_%s_beam.txt" % (
        version, region, region, version)

    mname = "/scratch/r/rbond/msyriac/data/depot/tilec/v1.2.0_20200324//%s_%s/tilec_mask.fits" % (
        version, region)

    # shutil.copy(yname,"/scratch/r/rbond/msyriac/data/for_sigurd/")
    # shutil.copy(sname,"/scratch/r/rbond/msyriac/data/for_sigurd/")
    # shutil.copy(mname,"/scratch/r/rbond/msyriac/data/for_sigurd/")
    # continue

    mask = maps.binary_mask(enmap.read_map(mname))

    # Planck
    cols = catalogs.load_fits(
        "/scratch/r/rbond/msyriac/data/planck/data/J_A+A_594_A27.fits",
        ['RAdeg', 'DEdeg'])
    ras = cols['RAdeg']
    decs = cols['DEdeg']

    # ACT
    cols = catalogs.load_fits("paper/E-D56Clusters.fits", ['RAdeg', 'DECdeg'])
    ras = np.append(ras, cols['RAdeg'])
    decs = np.append(decs, cols['DECdeg'])

    if region == 'boss':
        radius = 10