예제 #1
0
def make_map(fname_dat):
    """Makes map from alm file, optionally removes alm file."""
    # columns: l*l+l+m+1 (ells); real; imag
    alms = read_alm(fname_dat)
    Map = alm2map(alms, nside=nside)

    fname_map = fname_dat.split("dat_klm.fits")[0]+"map.fits"
    write_map(fname_map, Map, overwrite=True)
    print("    constructed map %s" % fname_map.split("/")[-1])
    # os.system("rm %s" % fname_dat)
    return None
예제 #2
0
importlib.reload(plot_ps)

lmin = 2
lmax = 1000
ls = np.arange(0, lmax)
nside = 400


def t(ls):
    return ls * (ls + 1)


shape, wcs = enmap.fullsky_geometry(res=20 * utils.arcmin, proj='car')
# generate unlensed map using input unlensd ps
unlensed_ps = load_data.unlensed(lmin, lmax, 'TT').spectra()
unlensed_map = curvedsky.rand_map(shape, wcs, unlensed_ps)
unlensed_alm = curvedsky.map2alm(unlensed_map, lmax=lmax)

# generate deflection potential using input
input_cldd = load_data.input_cldd(lmin, lmax).spectra()

if 1:
    phi_lm = fitsfunc.read_alm('./fullskyPhi_alm_00000.fits')
    phi_lm = phi_lm.astype(np.cdouble)
    cl_phi = sphtfunc.alm2cl(a)[0:lmax]
    cl_dd = cl_phi * t(ls)

if 1:
    plot_ps.plot(lmin, lmax, [input_cldd, cl_dd], ['1', '2'])
예제 #3
0
def obs_lm_TT():
    alm = fitsfunc.read_alm('./simu_map.py')
    alm = alm.astype(np.cdouble)
    return alm
예제 #4
0
def lensed_lm():
    alm = fitsfunc.read_alm('./fullskyLensedCMB_alm_set00_00000.fits')
    alm = alm.astype(np.cdouble)
    return alm
a = a.reshape(500, 1999)
b = b.reshape(500, 1999)
R = R.reshape(500, 1999)

# Initialize arrays

# for N in arange(int(sys.argv[1]),500,int(sys.argv[2])):
for N in xrange(0, 100):
    print "#########################################################"
    print ""
    print N
    print ""
    print "#########################################################"

    # Read In alms and cls
    alm = hpf.read_alm("Maps/alm_l_" + str(N) + ".fits")
    flm = hpf.read_alm("Maps/alm_nl_" + str(N) + ".fits")
    Alm = zeros(alm.shape[0], complex)
    Blm = zeros(alm.shape[0], complex)
    CAB2l = zeros((a.shape[0], LMAX + 1))
    CABBl = zeros((a.shape[0], LMAX + 1))
    clab2 = zeros(CAB2l.shape[1])
    clabb = zeros(CAB2l.shape[1])

    for r in xrange(a.shape[0]):
        print r
        for l in xrange(2, LMAX):
            I = hps.Alm.getidx(LMAX, l, arange(min(LMAX, l) + 1))
            Alm[I] = a[r][l - 2] * (alm[I] + fnl * flm[I]) / cl[l]
            Blm[I] = b[r][l - 2] * (alm[I] + fnl * flm[I]) / cl[l]
예제 #6
0
from pylab import *
from healpy.fitsfunc import read_alm
from healpy.sphtfunc import alm2cl


almg = read_alm('/home/jobryan/joseph_fnl_sims/alm_l_0001_v3.fits')
almng = read_alm('/home/jobryan/joseph_fnl_sims/alm_nl_0001_v3.fits')
almng = 100*almng
cl1 = alm2cl(almg)
cl2 = alm2cl(almg+almng)
cl3 = alm2cl(almng)
dcl = cl2-cl1
l = arange(len(cl1))

semilogy(l**2*cl1/2.0/pi,label='cl1')
semilogy(l**2*cl2/2.0/pi,label='cl2')
semilogy(l**2*cl3/2.0/pi,label='cl3')
semilogy(l**2*dcl/2.0/pi,label='dcl')
xlim(0,1000)
#ylim(1.0e-11,1.0e-8)
legend(loc='best').draw_frame(0)
show()