for ar_id, ar in enumerate(arrays): win_T = so_map.read_map(d["window_T_%s_%s" % (sv, ar)]) win_pol = so_map.read_map(d["window_pol_%s_%s" % (sv, ar)]) window_tuple = (win_T, win_pol) del win_T, win_pol # we add fg alms to cmb alms in temperature alms_beamed = alms.copy() alms_beamed[0] += fglms[id_freq[d["nu_eff_%s_%s" % (sv, ar)]]] # we convolve signal + foreground with the beam of the array l, bl = pspy_utils.read_beam_file(d["beam_%s_%s" % (sv, ar)]) alms_beamed = curvedsky.almxfl(alms_beamed, bl) if scenario == "noE": alms_beamed[1] *= 0 if scenario == "noB": alms_beamed[2] *= 0 # generate our signal only sim split = sph_tools.alm2map(alms_beamed, template[sv]) # compute the alms of the sim master_alms[sv, ar, "nofilter"] = sph_tools.get_alms( split, window_tuple, niter, lmax, dtype=sim_alm_dtype) # apply the k-space filter
sv2_list += [sv2] ar2_list += [ar2] n_mcms += 1 print("number of mcm matrices to compute : %s" % n_mcms) so_mpi.init(True) subtasks = so_mpi.taskrange(imin=0, imax=n_mcms - 1) print(subtasks) for task in subtasks: task = int(task) sv1, ar1, sv2, ar2 = sv1_list[task], ar1_list[task], sv2_list[ task], ar2_list[task] print("%s_%s x %s_%s" % (sv1, ar1, sv2, ar2)) l, bl1 = pspy_utils.read_beam_file(d["beam_%s_%s" % (sv1, ar1)]) win1_T = so_map.read_map(d["window_T_%s_%s" % (sv1, ar1)]) win1_pol = so_map.read_map(d["window_pol_%s_%s" % (sv1, ar1)]) l, bl2 = pspy_utils.read_beam_file(d["beam_%s_%s" % (sv2, ar2)]) win2_T = so_map.read_map(d["window_T_%s_%s" % (sv2, ar2)]) win2_pol = so_map.read_map(d["window_pol_%s_%s" % (sv2, ar2)]) mbb_inv, Bbl = so_mcm.mcm_and_bbl_spin0and2(win1=(win1_T, win1_pol), win2=(win2_T, win2_pol), bl1=(bl1, bl1), bl2=(bl2, bl2), binning_file=d["binning_file"], niter=d["niter"], lmax=d["lmax"], type=d["type"],
pspy_utils.create_directory(plot_dir) spectra = ["TT", "TE", "TB", "ET", "BT", "EE", "EB", "BE", "BB"] surveys = d["surveys"] lmax = d["lmax"] type = d["type"] binning_file = d["binning_file"] lth = np.arange(2, lmax + 2) for sv in surveys: arrays = d["arrays_%s" % sv] for id_ar1, ar1 in enumerate(arrays): for id_ar2, ar2 in enumerate(arrays): if id_ar1 > id_ar2: continue l, bl_ar1 = pspy_utils.read_beam_file(d["beam_%s_%s" % (sv, ar1)]) l, bl_ar2 = pspy_utils.read_beam_file(d["beam_%s_%s" % (sv, ar2)]) lb, bb_ar1 = pspy_utils.naive_binning(l, bl_ar1, binning_file, lmax) lb, bb_ar2 = pspy_utils.naive_binning(l, bl_ar2, binning_file, lmax) nsplits = len(d["maps_%s_%s" % (sv, ar1)]) spec_name_noise = "%s_%s_%sx%s_%s_noise" % (type, sv, ar1, sv, ar2) print(spec_name_noise) lb, nbs = so_spectra.read_ps("%s/%s.dat" % (spectra_dir, spec_name_noise), spectra=spectra)