Exemple #1
0
def readcamb(tfile, n, R, sigR, omb, omc, ksp):
#readcmb: Reads in a CAMB output file, constructs P(k) and splines onto a different set of
#k's if requested (ksp)
# tfile = Name of cmbfast output file (containing the transfer fxn)
# n = spectral tilt
# R = radius to which power spectrum is to be normalized (corresponding to sigma_R)
# sigR = sigma_R value to which power spectrum is to be normalized
# omb = omega_b
# omc = omega_c
# ksp = if splining onto a different basis is desired, these are the abiscuss values, the input
# 	into sigmaR must be LOG spaced in k, so if the k's in the cmbfast output file are not
#	equally spaced in log, ksp MUST be specified, set equal to 0.0 if no splining is required

  kread, Tc, Tb, Tgamma, Tnu, moo, moo2= np.loadtxt(tfile, unpack=True)
  omt = omb + omc
# Construct the transfer fxn...
  xfer = omb/omt * Tb + omc/omt * Tc
  Pread = xfer**2 * kread**n
  k = kread
  power = Pread

# Spline if necessary
  if np.size(ksp) != 1:
    k = ksp
    power = spllog(ksp, Pread, kread)

# Normalize to sigma_R
  sigma_R = sigmaR(k, power, R)
  bias = sigR/sigma_R
  power = power*bias**2

  return power
Exemple #2
0
nmuo2 = np.size(x) / 2
mu_fid2 = x[0:nmuo2] ** 2.0
weighto2 = weight[0:nmuo2]
r_fid = r
r_fid2 = r_fid ** 2.0
L2_fid = 0.5 * (3.0 * mu_fid2 - 1.0)

# OUTPUT FILES
fout = open("cov_diag", "w")
figout = PdfPages("dinv" + dd + uu + "_poly" + str(nptm) + str(nptq) + "_" + gom + ".pdf")
fouta = open("dalpha" + dd + uu + "_poly" + str(nptm) + str(nptq) + "_" + gom + ".txt", "w")
# ==============================================================================

ksp = makeksp(0.15e-4, 200.0, 1000.0)
psp = readcamb("dr9_full.ztf", ns, 8.0, sigma8_lin, omega_b, omega_c, ksp)
print "sigmaR =", sigmaR(ksp, psp, 8.0)

# spline no wiggle transfer function onto same k-grid as P(k)
tspnw = spllog(ksp, tnw, knw)

# apodize psp
p_nw = Pnw(tspnw, psp, ksp, ns)

kcovdex = np.squeeze(np.where(ksp < 1000.0 / max(r)))
ksp_c = ksp[kcovdex]
nsims = 1.0
totsim = 610

if gom == "gc":
    spars = [sigperp, sigpar, sig_s, beta_c]
    zdist_g, pdw_g = zP_gauss(x, psp * bias2, p_nw * bias2, ksp, spars, "exp")
  snl = signl_ap+2.
if(stemp == 'm'):
  snl = signl_ap-2.
if(stemp == 'i'):
  snl = 1000.0
ss = "_snl"+str(int(snl))

#OUTPUT FILES
figout = PdfPages('ninv'+dd+uu+'_poly'+str(npt)+'_'+gom+ss+'.pdf')
fout = open("nalpha"+dd+uu+"_poly"+str(npt)+"_"+gom+ss+".txt","w")
fouts = open("nstd"+dd+uu+"_poly"+str(npt)+"_"+gom+ss+".txt","w")
#==============================================================================

ksp = makeksp(0.15e-4,200.0,1000.0)
psp = readcamb("dr9_full.ztf", ns, 8.0, sigma8_lin, omega_b, omega_c, ksp)
print 'sigmaR =', sigmaR(ksp, psp, 8.0)
psp_c = psp*bias**2.
nk = np.size(ksp)

#spline no wiggle transfer function onto same k-grid as P(k), then apodize
tspnw = spllog(ksp, tnw, knw)
pc = apodize(tspnw, psp_c, ksp, ns, signl_ap)

kcovdex = np.squeeze(np.where(ksp < 1000.0/max(r)))
ksp_c = ksp[kcovdex]
pc = pc[kcovdex]

if(gom == 'gc'):
  npc = np.size(kcovdex)
  stream = calc_stream(ksp_c,npc,beta,par3,'exp')
  pvol = [par0,par1,par2]