Exemplo n.º 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
Exemplo n.º 2
0
    Config.write(open(fout_dir + "config.ini", 'w'))

lens_order = Config.get(sim_section, 'lens_order')

pol = args.do_pol
if pol: raise NotImplementedError

shape_sim, wcs_sim, shape_dat, wcs_dat = aio.enmaps_from_config(
    Config, sim_section, analysis_section, pol=pol)
if rank == 0:
    print(("Dat shape : ", shape_dat))
    print(("Sim shape : ", shape_sim))
analysis_resolution = np.min(
    enmap.extent(shape_dat, wcs_dat) / shape_dat[-2:]) * 60. * 180. / np.pi
pixratio = analysis_resolution / Config.getfloat(sim_section, "pixel_arcmin")
min_ell = fmaps.minimum_ell(shape_dat, wcs_dat)

parray_dat = aio.patch_array_from_config(Config,
                                         expf_name,
                                         shape_dat,
                                         wcs_dat,
                                         dimensionless=False)
parray_sim = aio.patch_array_from_config(Config,
                                         expf_name,
                                         shape_sim,
                                         wcs_sim,
                                         dimensionless=False)

# Efficiently distribute sims over MPI cores
num_each, each_tasks = mpi_distribute(Nsims, numcores)
# Initialize a container for stats and stacks