コード例 #1
0
ファイル: tmp.py プロジェクト: jobryan/bispectrum_calculation
lmax = 990

dl = 20
nbins = lmax / dl
ltmp = np.arange(dl/2, lmax, dl)

ell = np.arange(998) + 2
ellsq = ell * (ell + 1) / 2 / np.pi

cth = np.loadtxt("output/cl21_ana_chang.txt", usecols=(1,),unpack=True)
cdata = np.loadtxt("output/cl21_data.dat")
csims = np.zeros((nsims,1499))

for i in np.arange(nsims):
    csims[i] = np.loadtxt("output/cl21_sim_%i.dat" % i)
    
csim_binned = (lbin(np.average(csims, axis=0), bin=dl)[:lmax])[ltmp]

cth_binned = (lbin(cth, bin=dl)[:lmax])[ltmp]
cdata_binned = (lbin(cdata, bin=dl)[:lmax])[ltmp]

#plt.plot(ell[:lmax], ellsq[:lmax] * cth[:lmax], label='theory')
plt.plot(ell[ltmp], ellsq[ltmp] * cdata_binned, label='data')
plt.plot(ell[ltmp], ellsq[ltmp] * csim_binned, label='sim')
plt.ylabel(r"$\ell(\ell+1)/(2\pi) C_{\ell}^{(2,1)}$", fontsize=20)
plt.xlabel(r"$\ell$", fontsize=20)
plt.legend(loc=4)
plt.show()


コード例 #2
0
import helpers as h
from lbin import lbin

nsims = 11
nl = 1499

dl = 20
nbins = nl / dl
ltmp = np.arange(dl/2, nl, dl)

l = np.arange(nl)
lsq = l * (l+1) / 2 / np.pi

fn_cltt_data = 'output/cltt_data.dat'
cltt_data = np.loadtxt(fn_cltt_data)

cltt_sims = np.zeros((nsims, nl))
for sim in range(1,nsims+1):
    fn_cltt_sim = 'output/cltt_sim_%i.dat' % sim
    cltt_sims[sim-1] = np.loadtxt(fn_cltt_sim)

cltt_sim_binned = (lbin(np.average(cltt_sims, axis=0), bin=dl)[:nl])[ltmp]

# h.plot_ps([l] * nsims, [lsq*cl for cl in cltt_sims] + [lsq*cltt_data], 
#           ['sim %i' % i for i in range(1,nsims+1)] + ['data'], 
#           s_ylabel='$\ell(\ell+1)/2\pi C_\ell$', s_title='', 
#         s_fn_plot='plots/cltts.png')

h.plot_ps([l[ltmp], l], [cltt_sim_binned, cltt_data], 
          ['sim average', 'data'], s_ylabel='$C_\ell$', 
          s_title='', s_fn_plot='plots/cltts.png')
コード例 #3
0
    err = y - fnl*ay
    return err

fnl = 0
#nl = 1024
nl = 600
lmax = 600

x = linspace(50,550,6)
ell = arange(20,lmax,40)
#cth = loadtxt("joe/wandelt_noNoise.dat")
#cth = loadtxt("output/cl_21_ana_437_rsteps_1499_ellsteps.dat")
cth = loadtxt("output/cl21_ana_chang.txt", usecols=(1,), unpack=True)

l = arange(1,cth.shape[0]+1)
cth = lbin(cth*(2*l+1),bin=40)
cth = cth[:lmax]
Cth = cth[ell]

N=11
FNL=zeros(N)

runType = 'data' #'sim', 'data', 'fnl'

print runType

for i in range(1,N):
    l = arange(nl)
    #cloc = loadtxt("VNoiseNoMask0/clocV_"+ str(i)+"_fnl%i_nonoisenobeam.dat" % fnl)
    if runType == 'fnl':
        cloc = loadtxt("output/cl21_fnl_%i_sim_%i.dat" % (fnl, i))