coupling = so_cov.cov_coupling_spin0and2_simple(win, lmax, niter=niter) speclist = ["TT", "TE", "ET", "EE"] nspec = len(speclist) analytic_cov = np.zeros((nspec * nbins, nspec * nbins)) for i, (W, X) in enumerate(speclist): for j, (Y, Z) in enumerate(speclist): id0 = W + "a" + Y + "c" id1 = X + "b" + Z + "d" id2 = W + "a" + Z + "d" id3 = X + "b" + Y + "c" M = coupling[id0.replace("E", "P") + id1.replace("E", "P")] * so_cov.chi( na, nc, nb, nd, ns, ps_all, nl_all, W + Y + X + Z) M += coupling[id2.replace("E", "P") + id3.replace("E", "P")] * so_cov.chi( na, nd, nb, nc, ns, ps_all, nl_all, W + Z + X + Y) analytic_cov[i * nbins:(i + 1) * nbins, j * nbins:(j + 1) * nbins] = so_cov.bin_mat( M, binning_file, lmax) mbb_inv_ab, Bbl_ab = so_mcm.read_coupling(prefix="%s/%sx%s" % (mcm_dir, na, nb), spin_pairs=spin_pairs) mbb_inv_ab = so_cov.extract_TTTEEE_mbb(mbb_inv_ab) mbb_inv_cd, Bbl_cd = so_mcm.read_coupling(prefix="%s/%sx%s" % (mcm_dir, nc, nd),
win = {} win["Ta"] = so_map.read_map("%s/window_%s.fits" % (window_dir, na)) win["Tb"] = so_map.read_map("%s/window_%s.fits" % (window_dir, nb)) win["Tc"] = so_map.read_map("%s/window_%s.fits" % (window_dir, nc)) win["Td"] = so_map.read_map("%s/window_%s.fits" % (window_dir, nd)) win["Pa"] = so_map.read_map("%s/window_%s.fits" % (window_dir, na)) win["Pb"] = so_map.read_map("%s/window_%s.fits" % (window_dir, nb)) win["Pc"] = so_map.read_map("%s/window_%s.fits" % (window_dir, nc)) win["Pd"] = so_map.read_map("%s/window_%s.fits" % (window_dir, nd)) coupling = so_cov.cov_coupling_spin0and2_simple(win, lmax, niter=niter) analytic_cov = np.zeros((4 * nbins, 4 * nbins)) # TaTbTcTd M_00 = coupling["TaTcTbTd"] * so_cov.chi(na, nc, nb, nd, ns, ps_all, nl_all, "TTTT") M_00 += coupling["TaTdTbTc"] * so_cov.chi(na, nd, nb, nc, ns, ps_all, nl_all, "TTTT") analytic_cov[0 * nbins:1 * nbins, 0 * nbins:1 * nbins] = so_cov.bin_mat(M_00, binning_file, lmax) # TaEbTcEd M_11 = coupling["TaTcPbPd"] * so_cov.chi(na, nc, nb, nd, ns, ps_all, nl_all, "TTEE") M_11 += coupling["TaPdPbTc"] * so_cov.chi(na, nd, nb, nc, ns, ps_all, nl_all, "TEET") analytic_cov[1 * nbins:2 * nbins, 1 * nbins:2 * nbins] = so_cov.bin_mat(M_11, binning_file, lmax)
na, nb, nc, nd = na_list[task], nb_list[task], nc_list[task], nd_list[task] win = {} win["Ta"] = so_map.read_map("%s/window_T_%s-hm1.fits"%(windows_dir, na)) win["Tb"] = so_map.read_map("%s/window_T_%s-hm2.fits"%(windows_dir, nb)) win["Tc"] = so_map.read_map("%s/window_T_%s-hm1.fits"%(windows_dir, nc)) win["Td"] = so_map.read_map("%s/window_T_%s-hm2.fits"%(windows_dir, nd)) win["Pa"] = so_map.read_map("%s/window_P_%s-hm1.fits"%(windows_dir, na)) win["Pb"] = so_map.read_map("%s/window_P_%s-hm2.fits"%(windows_dir, nb)) win["Pc"] = so_map.read_map("%s/window_P_%s-hm1.fits"%(windows_dir, nc)) win["Pd"] = so_map.read_map("%s/window_P_%s-hm2.fits"%(windows_dir, nd)) coupling = so_cov.cov_coupling_spin0and2_simple(win, lmax, niter=niter, planck=True) analytic_cov = np.zeros((4*nbins, 4*nbins)) # EaEbEcEd M_00 = coupling["PaPcPbPd"] * so_cov.chi(na, nc, nb, nd, ns, ps_all, nl_all, "EEEE") M_00 += coupling["PaPdPbPc"] * so_cov.chi(na, nd, nb, nc, ns, ps_all, nl_all, "EEEE") analytic_cov[0*nbins:1*nbins, 0*nbins:1*nbins] = so_cov.bin_mat(M_00, binning_file, lmax) # EaBbEcBd M_11 = coupling["PaPcPbPd"] * so_cov.chi(na, nc, nb, nd, ns, ps_all, nl_all, "EEBB") M_11 += coupling["PaPdPbPc"] * so_cov.chi(na, nd, nb, nc, ns, ps_all, nl_all, "EBBE") analytic_cov[1*nbins:2*nbins, 1*nbins:2*nbins] = so_cov.bin_mat(M_11, binning_file, lmax) # BaEbBcEd M_22 = coupling["PaPcPbPd"] * so_cov.chi(na, nc, nb, nd, ns, ps_all, nl_all, "BBEE") M_22 += coupling["PaPdPbPc"] * so_cov.chi(na, nd, nb, nc, ns, ps_all, nl_all, "BEEB") analytic_cov[2*nbins:3*nbins, 2*nbins:3*nbins] = so_cov.bin_mat(M_22, binning_file, lmax) # BaBbBcBd M_33 = coupling["PaPcPbPd"] * so_cov.chi(na, nc, nb, nd, ns, ps_all, nl_all, "BBBB")