Exemplo n.º 1
0
HFI_files = []
for i in xrange(N_freqs):
    print("----------")
    print(HFI_freqs[i])
    HFI_files.append('../data/HFI_BANDPASS_F' + HFI_freqs[i] + '_reformat.txt')
    HFI_loc = np.loadtxt(HFI_files[i])
    # check norm, i.e., make sure response is unity for CMB
    HFI_loc_GHz = HFI_loc[:, 0]
    HFI_loc_trans = HFI_loc[:, 1]
    print("CMB norm = ", np.trapz(HFI_loc_trans, HFI_loc_GHz))
    # check various conversions against Table 6 of https://arxiv.org/pdf/1303.5070.pdf
    # N.B.: uncertainties on these conversions are ~<0.1% for 100/143/217/353/545, and ~1% for 857 GHz (larger uncertainty for 857 is because the conversions strongly depend on low-freq tail of the bandpass in this case, which is less well-measured)
    # compute K_CMB -> y_SZ conversion
    print(
        "K_CMB -> y_SZ conversion: ",
        np.trapz(HFI_loc_trans * dBnudT(HFI_loc_GHz) * 1.e6, HFI_loc_GHz) /
        np.trapz(
            HFI_loc_trans * dBnudT(HFI_loc_GHz) * 1.e6 *
            get_mix(HFI_loc_GHz, 'tSZ') / TCMB_uK, HFI_loc_GHz) / TCMB)
    # compute K_CMB -> MJy/sr conversion [IRAS convention, alpha=-1 power-law SED]
    print(
        "K_CMB -> MJy/sr conversion [IRAS convention, alpha=-1 power-law SED]: ",
        np.trapz(HFI_loc_trans * dBnudT(HFI_loc_GHz) * 1.e6, HFI_loc_GHz) /
        np.trapz(HFI_loc_trans *
                 (HFI_freqs_GHz[i] / HFI_loc_GHz), HFI_loc_GHz) * 1.e20)
    # compute color correction from IRAS to "dust" (power-law with alpha=4)
    print(
        "MJy/sr color correction (power-law, alpha=-1 to alpha=4): ",
        np.trapz(HFI_loc_trans *
                 (HFI_freqs_GHz[i] / HFI_loc_GHz), HFI_loc_GHz) /
        np.trapz(HFI_loc_trans *
Exemplo n.º 2
0
def test_conversions():
    assert np.isclose(tfg.ItoDeltaT(545) / 1e26, 0.017483363768883677)
    for f in np.geomspace(1, 1000, 1000):
        assert np.isclose(tfg.ItoDeltaT(f), 1 / tfg.dBnudT(f))
Exemplo n.º 3
0
LFI_freqs.append('070')
LFI_freqs_GHz = np.array([30.0, 44.0, 70.0])
LFI_files = []
for i in xrange(N_freqs):
    print("----------")
    print(LFI_freqs[i])
    LFI_files.append('../data/LFI_BANDPASS_F' + LFI_freqs[i] + '_reformat.txt')
    LFI_loc = np.loadtxt(LFI_files[i])
    # check norm, i.e., make sure response is unity for CMB
    LFI_loc_GHz = LFI_loc[:, 0]
    LFI_loc_trans = LFI_loc[:, 1]
    print("CMB norm = ", np.trapz(LFI_loc_trans, LFI_loc_GHz))
    # compute K_CMB -> y_SZ conversion
    print(
        "K_CMB -> y_SZ conversion: ",
        np.trapz(LFI_loc_trans * dBnudT(LFI_loc_GHz) * 1.e6, LFI_loc_GHz) /
        np.trapz(
            LFI_loc_trans * dBnudT(LFI_loc_GHz) * 1.e6 *
            get_mix(LFI_loc_GHz, 'tSZ') / TCMB_uK, LFI_loc_GHz) / TCMB)
    # compute K_CMB -> MJy/sr conversion [IRAS convention, alpha=-1 power-law SED]
    print(
        "K_CMB -> MJy/sr conversion [IRAS convention, alpha=-1 power-law SED]: ",
        np.trapz(LFI_loc_trans * dBnudT(LFI_loc_GHz) * 1.e6, LFI_loc_GHz) /
        np.trapz(LFI_loc_trans *
                 (LFI_freqs_GHz[i] / LFI_loc_GHz), LFI_loc_GHz) * 1.e20)
    # compute color correction from IRAS to "dust" (power-law with alpha=4)
    print(
        "MJy/sr color correction (power-law, alpha=-1 to alpha=4): ",
        np.trapz(LFI_loc_trans *
                 (LFI_freqs_GHz[i] / LFI_loc_GHz), LFI_loc_GHz) /
        np.trapz(LFI_loc_trans *
Exemplo n.º 4
0
        pl = io.Plotter(xlabel='l',ylabel='b')
        for i in range(bnus.shape[0]):

            if trans[i]>1e-1: pl.add(ells,bnus[i]/lbeam)
        pl.hline(y=1)
        pl._ax.set_ylim(0.8,1.2)
        pl.done("abeams_%s.png" % qid)
            
        


    

    mixc = tfg.get_mix(cfreq, comp)
    mix = tfg.get_mix(nu_ghz, comp)
    mix2 = np.trapz(trans * tfg.dBnudT(nu_ghz) * mix, nu_ghz) / np.trapz(trans * tfg.dBnudT(nu_ghz), nu_ghz)
    mix3 = np.trapz(trans * tfg.dBnudT(nu_ghz) * bnus.swapaxes(0,1) * mix, nu_ghz) / np.trapz(trans * tfg.dBnudT(nu_ghz), nu_ghz) / lbeam
    print(qid,mixc,mix2,mix3[300])

    if qid in ['p01','p02']:
        lmax = 300
    elif 'p' in qid:
        lmax = 3000
    else:
        lmax = 10000
    
    pl = io.Plotter(xyscale='linlin',xlabel='l',ylabel='r')
    pl.add(ells[ells<lmax],(mixc/mix2+0*ells)[ells<lmax],label='cfreq approx')
    pl.add(ells[ells<lmax],(mix3/mix2)[ells<lmax],label='color corrected')
    pl.hline(y=1)
    pl.done("modbeam_%s.png" % qid)
Exemplo n.º 5
0
]
al_1 = 0.0
al_2 = -1.0  #diffuse sources
for i in xrange(N_freqs):
    print("----------")
    print(i, ACT_freqs_GHz[i], ACT_files[i])
    ACT_loc = np.loadtxt(ACT_file_dir + ACT_files[i])
    ACT_loc_GHz = ACT_loc[:, 0]
    ACT_loc_trans = ACT_loc[:, 1]
    ACT_loc_trans_err = ACT_loc[:, 2]
    nu = ACT_loc_GHz * 1.e9  #Hz
    dnu = nu[1] - nu[
        0]  #all of the ACT bandpass files have equally spaced samples in frequency (though the spacing is different for different bandpasses)
    fnu = ACT_loc_trans
    # effective frequency for CMB -- following Rahul's notebook
    nu_be_CMB = dBnudT(ACT_loc_GHz) * TCMB_uK
    nu_eff_CMB1 = np.sum(
        nu * fnu * nu**(-2. * (1. + al_1)) * nu_be_CMB * dnu) / np.sum(
            fnu * nu**(-2. * (1. + al_1)) * nu_be_CMB * dnu)
    nu_eff_CMB2 = np.sum(
        nu * fnu * nu**(-2. * (1. + al_2)) * nu_be_CMB * dnu) / np.sum(
            fnu * nu**(-2. * (1. + al_2)) * nu_be_CMB * dnu)
    nu_eff_CMB = 0.5 * (nu_eff_CMB1 + nu_eff_CMB2)
    print('nu_eff_CMB1 =', "{0:.1f}".format(nu_eff_CMB1 / 1.e9))
    print('nu_eff_CMB2 =', "{0:.1f}".format(nu_eff_CMB2 / 1.e9))
    print('nu_eff_CMB =', "{0:.1f}".format(nu_eff_CMB / 1.e9), '+/-', 2.4,
          'GHz'
          )  #uncertainty is due to systematic uncertainty in FTS measurements
    # effective frequency for tSZ -- following Rahul's notebook
    nu_be_SZ = nu_be_CMB * get_mix(ACT_loc_GHz, 'tSZ') / TCMB_uK
    nu_eff_SZ1 = np.sum(nu * fnu * nu**(-2. * (1. + al_1)) * nu_be_SZ *