Exemple #1
0
def recon_from_config(Config,
                      recon_section,
                      parray,
                      theory,
                      lmax,
                      grad_cut=None,
                      pol=False,
                      u_equals_l=True):
    min_ell = fmaps.minimum_ell(parray.shape, parray.wcs)
    lb = ellbounds_from_config(Config, recon_section, min_ell)
    tellmin = lb['tellminY']
    tellmax = lb['tellmaxY']
    pellmin = lb['pellminY']
    pellmax = lb['pellmaxY']
    kellmin = lb['kellmin']
    kellmax = lb['kellmax']

    lxmap_dat, lymap_dat, modlmap_dat, angmap_dat, lx_dat, ly_dat = fmaps.get_ft_attributes_enmap(
        parray.shape, parray.wcs)
    template_dat = fmaps.simple_flipper_template_from_enmap(
        parray.shape, parray.wcs)
    nT = parray.nT
    nP = parray.nP
    kbeam_dat = parray.lbeam
    fMaskCMB_T = fmaps.fourierMask(lx_dat,
                                   ly_dat,
                                   modlmap_dat,
                                   lmin=tellmin,
                                   lmax=tellmax)
    fMaskCMB_P = fmaps.fourierMask(lx_dat,
                                   ly_dat,
                                   modlmap_dat,
                                   lmin=pellmin,
                                   lmax=pellmax)
    fMask = fmaps.fourierMask(lx_dat,
                              ly_dat,
                              modlmap_dat,
                              lmin=kellmin,
                              lmax=kellmax)
    with oio.nostdout():
        from alhazen.quadraticEstimator import Estimator
        qest = Estimator(template_dat,
                         theory,
                         theorySpectraForNorm=None,
                         noiseX2dTEB=[nT, nP, nP],
                         noiseY2dTEB=[nT, nP, nP],
                         fmaskX2dTEB=[fMaskCMB_T, fMaskCMB_P, fMaskCMB_P],
                         fmaskY2dTEB=[fMaskCMB_T, fMaskCMB_P, fMaskCMB_P],
                         fmaskKappa=fMask,
                         kBeamX=kbeam_dat,
                         kBeamY=kbeam_dat,
                         doCurl=False,
                         TOnly=not (pol),
                         halo=True,
                         uEqualsL=u_equals_l,
                         gradCut=grad_cut,
                         bigell=lmax)

    return tellmin, tellmax, pellmin, pellmax, kellmin, kellmax, qest
Exemple #2
0
    def _init_qests(self):

        
        mlist = ['e','s','r']
        self.qest = {}
        tellminY = 500
        tellmaxY = 3000
        pellminY = 500
        pellmaxY = 3000
        tellminX = 500
        tellmaxX = 3000
        pellminX = 500
        pellmaxX = 3000
        kellmin = 80
        kellmax = 3000
        self.kellmin = kellmin
        self.kellmax = kellmax
        
        for m in mlist:
            lxmap_dat,lymap_dat,modlmap_dat,angmap_dat,lx_dat,ly_dat = fmaps.get_ft_attributes_enmap(self.shape[m],self.wcs[m])
            nT = modlmap_dat.copy()*0.
            nP = modlmap_dat.copy()*0.
            lbeam = modlmap_dat.copy()*0.+1.
            template_dat = fmaps.simple_flipper_template_from_enmap(self.shape[m],self.wcs[m])
            fMaskCMB_TX = fmaps.fourierMask(lx_dat,ly_dat,modlmap_dat,lmin=tellminX,lmax=tellmaxX)
            fMaskCMB_TY = fmaps.fourierMask(lx_dat,ly_dat,modlmap_dat,lmin=tellminY,lmax=tellmaxY)
            fMaskCMB_PX = fmaps.fourierMask(lx_dat,ly_dat,modlmap_dat,lmin=pellminX,lmax=pellmaxX)
            fMaskCMB_PY = fmaps.fourierMask(lx_dat,ly_dat,modlmap_dat,lmin=pellminY,lmax=pellmaxY)
            fMask = fmaps.fourierMask(lx_dat,ly_dat,modlmap_dat,lmin=kellmin,lmax=kellmax)
            with io.nostdout():
                self.qest[m] = Estimator(template_dat,
                                         self.theory,
                                         theorySpectraForNorm=None,
                                         noiseX2dTEB=[nT,nP,nP],
                                         noiseY2dTEB=[nT,nP,nP],
                                         fmaskX2dTEB=[fMaskCMB_TX,fMaskCMB_PX,fMaskCMB_PX],
                                         fmaskY2dTEB=[fMaskCMB_TY,fMaskCMB_PY,fMaskCMB_PY],
                                         fmaskKappa=fMask,
                                         kBeamX = lbeam,
                                         kBeamY = lbeam,
                                         doCurl=False,
                                         TOnly=True,
                                         halo=True,
                                         uEqualsL=True,
                                         gradCut=None,verbose=False,
                                         bigell=self.lmax)
Exemple #3
0
lbinner_sim = stats.bin2D(modlmap_sim, lbin_edges)

sverif_cmb = SpectrumVerification(mpibox,
                                  theory,
                                  shape_sim,
                                  wcs_sim,
                                  lbinner=lbinner_sim,
                                  pol=True)
sverif_kappa = SpectrumVerification(mpibox,
                                    theory,
                                    shape_dat,
                                    wcs_dat,
                                    lbinner=lbinner_dat,
                                    pol=False)

template_dat = fmaps.simple_flipper_template_from_enmap(shape_dat, wcs_dat)
nT = parray_dat.nT
nP = parray_dat.nP
if rank == 0: io.quickPlot2d(nT, out_dir + "nt.png")
kbeam_dat = parray_dat.lbeam
kbeampass = kbeam_dat
if rank == 0: io.quickPlot2d(kbeampass, out_dir + "kbeam.png")
fMaskCMB_T = fmaps.fourierMask(lx_dat,
                               ly_dat,
                               modlmap_dat,
                               lmin=tellmin,
                               lmax=tellmax)
fMaskCMB_P = fmaps.fourierMask(lx_dat,
                               ly_dat,
                               modlmap_dat,
                               lmin=pellmin,
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,
                                       tellmaxX=tellmax,
Exemple #5
0
Nsims = int(50/numcores)
irange = list(range(rank*Nsims,(rank+1)*Nsims))
for i,k in enumerate(irange):
    print(i)
    measured = enmap.read_map(mapfile(k))
    measured = measured[0]/TCMB


    
    if i==0:
        shape_dat = measured.shape
        wcs_dat = measured.wcs

        # === ESTIMATOR ===

        template_dat = fmaps.simple_flipper_template_from_enmap(measured.shape,measured.wcs)
        lxmap_dat,lymap_dat,modlmap_dat,angmap_dat,lx_dat,ly_dat = fmaps.get_ft_attributes_enmap(shape_dat,wcs_dat)
        

        taper_percent = 15.0
        Ny,Nx = shape_dat
        taper = fmaps.cosineWindow(Ny,Nx,lenApodY=taper_percent*min(Ny,Nx)/100.,lenApodX=taper_percent*min(Ny,Nx)/100.,padY=0,padX=0)
        tapered = measured*taper
        # io.quickPlot2d(tapered,"map.png")
        w2 = np.mean(taper**2.)
        w4 = np.mean(taper**4.)

        
        debug_edges = np.arange(400,8000,150)
        dbinner_dat = stats.bin2D(modlmap_dat,debug_edges)