alms_beamed[0] += fglms[2 * fcount]
                alms_beamed[1] += fglms[2 * fcount + 1]

            alms_beamed = maps_to_params_utils.multiply_alms(
                alms_beamed, bl, ncomp)

            fcount += 1

            for k in range(nsplits):
                noisy_alms = alms_beamed.copy()

                noisy_alms[0] += nlms["T", k][fid]
                noisy_alms[1] += nlms["E", k][fid]
                noisy_alms[2] += nlms["B", k][fid]

                split = sph_tools.alm2map(noisy_alms, template)

                # Now that we have generated a split of data of experiment exp
                # and frequency freq, we take its harmonic transform
                split = maps_to_params_utils.remove_mean(
                    split, window_tuple, ncomp)
                master_alms[exp, freq,
                            k] = sph_tools.get_alms(split, window_tuple, niter,
                                                    lmax)

    # We now form auto and cross power spectra from the alms
    ps_dict = {}

    for id_exp1, exp1 in enumerate(experiments):
        freqs1 = d["freqs_%s" % exp1]
        nsplits1 = d["nsplits_%s" % exp1]
Beispiel #2
0
            l, bl_pol = np.loadtxt(d["beam_%s_%s_pol" % (freq, hm)],
                                   unpack=True)

            hm_alms[0] = hp.sphtfunc.almxfl(hm_alms[0], bl_T)
            hm_alms[1] = hp.sphtfunc.almxfl(hm_alms[1], bl_pol)
            hm_alms[2] = hp.sphtfunc.almxfl(hm_alms[2], bl_pol)

            if use_ffp10 == False:
                hm_alms[0] += nlms["T", k][f_id]
                hm_alms[1] += nlms["E", k][f_id]
                hm_alms[2] += nlms["B", k][f_id]

            for i in range(3):
                hm_alms[i] = hp.sphtfunc.almxfl(hm_alms[i], pixwin)

            pl_map = sph_tools.alm2map(hm_alms, template)
            if use_ffp10 == True:
                noise_map = so_map.read_map(
                    "%s/%s/ffp10_noise_%s_%s_map_mc_%05d.fits" %
                    (d["ffp10_dir"], freq, freq, hm, iii))
                noise_map.data *= 10**6
                pl_map.data += noise_map.data

            window_t = so_map.read_map("%s/window_T_%s_%s-%s.fits" %
                                       (windows_dir, exp, freq, hm))
            window_pol = so_map.read_map("%s/window_P_%s_%s-%s.fits" %
                                         (windows_dir, exp, freq, hm))
            window_tuple = (window_t, window_pol)
            del window_t, window_pol

            cov_map = so_map.read_map("%s" % map, fields_healpix=4)
                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

                binary = so_map.read_map("%s/binary_%s_%s.fits" %
                                         (window_dir, sv, ar))

                norm, split = data_analysis_utils.get_filtered_map(
                    split,
                    binary,
                    filter[sv],
Beispiel #4
0
            noisy_alms[1] += nlms['E', k][freq_id]
            noisy_alms[2] += nlms['B', k][freq_id]

            if include_sys == True:
                l, Tl_T = np.loadtxt(d['TF_%s_%s_T' % (freq, hm)], unpack=True)
                l, Tl_pol = np.loadtxt(d['TF_%s_%s_pol' % (freq, hm)],
                                       unpack=True)

                noisy_alms[0] = hp.sphtfunc.almxfl(noisy_alms[0], Tl_T)
                noisy_alms[1] = hp.sphtfunc.almxfl(noisy_alms[1], Tl_pol)
                noisy_alms[2] = hp.sphtfunc.almxfl(noisy_alms[2], Tl_pol)

            for i in range(3):
                noisy_alms[i] = hp.sphtfunc.almxfl(noisy_alms[i], pixwin)

            pl_map = sph_tools.alm2map(noisy_alms, template)

            window_T = so_map.read_map('%s/window_T_%s_%s-%s.fits' %
                                       (auxMapDir, experiment, freq, hm))
            window_pol = so_map.read_map('%s/window_P_%s_%s-%s.fits' %
                                         (auxMapDir, experiment, freq, hm))
            window_tuple = (window_T, window_pol)
            del window_T, window_pol

            cov_map = so_map.read_map('%s' % map, fields_healpix=4)
            badpix = (cov_map.data == hp.pixelfunc.UNSEEN)
            for i in range(3):
                pl_map.data[i][badpix] = 0.0
            if remove_mono_dipo_T:
                pl_map.data[0] = planck_utils.subtract_mono_di(
                    pl_map.data[0], window_tuple[0].data, pl_map.nside)