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)
from __future__ import print_function from orphics import io from pixell import enmap, reproject import numpy as np import os, sys import healpy as hp from orphics.maps import galactic_mask, north_galactic_mask, south_galactic_mask config = io.config_from_yaml( os.path.dirname(os.path.abspath(__file__)) + "/../input/config.yml") opath = config['data_path'] mask = hp.read_map(opath + config['mask_name']) io.mollview(mask, 'hp_carmask.png') print(mask.max(), mask.min()) nside = hp.nside2npix(mask.size) lmax = 3000 # CAR resolution is decided based on lmax res = np.deg2rad(2.0 * (3000 / lmax) / 60.) # Make the full sky geometry shape, wcs = enmap.band_geometry(np.deg2rad((-70, 30)), res=res) #shape,wcs = enmap.fullsky_geometry(res=res) # nside = 256 # nmask = north_galactic_mask(shape,wcs,nside) # io.plot_img(nmask,'low_north_gal.png') # nside = 256
from pixell import enmap import numpy as np import os,sys from soapack import interfaces as sints import healpy as hp nside = 1024 beam = 13.315 ztt = np.load("tt.npy")*1e12 zls = np.arange(0,len(ztt),1) froot = "/scratch/r/rbond/msyriac/data/planck/data/pr2/" mask = hp.ud_grade(hp.read_map(froot + "COM_Mask_Lensing_2048_R2.00.fits"),nside) mask = hp.smoothing(mask,fwhm=np.deg2rad(2)) io.mollview(mask,os.environ['WORK']+"/tiling/planck_mask.png") fsky = mask.sum()/mask.size print(fsky) full = hp.read_map(froot + "LFI_SkyMap_070_1024_R2.01_full.fits")*mask*1e6 ring1 = hp.read_map(froot + "LFI_SkyMap_070_1024_R2.01_full-ringhalf-1.fits")*mask*1e6 ring2 = hp.read_map(froot + "LFI_SkyMap_070_1024_R2.01_full-ringhalf-2.fits")*mask*1e6 # full = hp.read_map(froot + "HFI_SkyMap_143_2048_R2.02_full.fits")*mask*1e6 # ring1 = hp.read_map(froot + "HFI_SkyMap_143_2048_R2.02_full-ringhalf-1.fits")*mask*1e6 # ring2 = hp.read_map(froot + "HFI_SkyMap_143_2048_R2.02_full-ringhalf-2.fits")*mask*1e6 # hm1 = hp.read_map(froot + "HFI_SkyMap_143_2048_R2.02_halfmission-1.fits")*mask*1e6 # hm2 = hp.read_map(froot + "HFI_SkyMap_143_2048_R2.02_halfmission-2.fits")*mask*1e6 # print(ring1.shape,hm1.shape)
pl.add(ls,nls,ls="--",label='theory noise per mode') pl._ax.set_xlim(20,4000) pl.done(config['data_path']+"xcls_%s.png" % polcomb) # Filtered input fikalm = hp.almxfl(ikalm,wfilt) fimap = hp.alm2map(fikalm,nside=256) # Resampled mask dmask = hp.ud_grade(mask,nside_out=256) dmask[dmask<0] = 0 # Mollview plots io.mollview(frmap*dmask,config['data_path']+"wrmap1.png",xsize=1600,lim=8e-6) io.mollview(fimap*dmask,config['data_path']+"wimap1.png",xsize=1600,lim=8e-6) # CAR plots shape,wcs = enmap.band_geometry(np.deg2rad((-70,30)),res=np.deg2rad(0.5*8192/512/60.)) omask = reproject.enmap_from_healpix(dmask, shape, wcs,rot=None) omap = cs.alm2map(fkalm, enmap.empty(shape,wcs)) io.hplot(omap*omask,config['data_path']+"cwrmap1",grid=True,ticks=20,color='gray') omap = cs.alm2map(fikalm, enmap.empty(shape,wcs)) io.hplot(omap*omask,config['data_path']+"cwimap1",grid=True,ticks=20,color='gray')
region, "tsz", 'cib', "joint", beam=True) imask = enmap.read_map( tutils.get_generic_fname(tdir, region, "tsz", None, "joint", mask=True)) dmask = hp.alm2map( cs.map2alm(imask, lmax=lmax).astype(np.complex128), nside) dmask[dmask < 0.5] = 0 dmask[dmask > 0.5] = 1 jmask = dmask * mask io.mollview(jmask, os.environ['WORK'] + '/jmask_%s.png' % region) fsky = jmask.sum() / jmask.size print(fsky * 41252.) delta = hdelta * jmask galm = hp.map2alm(delta, lmax=lmax) for bfile, imap in zip([ybfile, cbfile, dbfile], [ymap, cmap, dmap]): yalm = hp.map2alm( hp.alm2map(cs.map2alm(imap, lmax=lmax).astype(np.complex128), nside=nside) * jmask, lmax=lmax) cls = hp.alm2cl(galm, yalm) assert np.all(np.isfinite(cls)) ells = np.arange(len(cls)) lbeam = get_beam(bfile, ells)