Esempio n. 1
0
import lensing as le
import numba
import camb

from IPython import embed

#embed()

arcmin2rad = np.pi / 180. / 60.
rad2arcmin = 1. / arcmin2rad
#Camb initialisation
pars = camb.CAMBparams()
data_camb = camb.get_background(pars)

cosmo = Cosmo()
cmbspec = cosmo.cmb_spectra(7000)
#cmbspec_r = Cosmo({'r':0.1}).cmb_spectra(12000,spec='tensor')[:,2]
clbb_r = Cosmo({'r': 1.}).cmb_spectra(400, spec='tensor')[:, 2]

MC_lin = pickle.load(open("MAGCAMB_ONLY_linear.pkl", "rb"))
MC_log = pickle.load(open("MAGCAMB_ONLY_log.pkl", "rb"))
FR = pickle.load(open("FINAL_FR.pkl", "rb"))
FR_lin = FR['mydic']
FR_log = FR['mydic1']

#Set up a new set of parameters for CAMB
pars = camb.CAMBparams()
#This function sets up CosmoMC-like settings, with one massive neutrino and helium set using BBN consistency
pars.set_cosmology(H0=67.5,
                   ombh2=0.022,
                   omch2=0.122,
Esempio n. 2
0
# 	AlTau = np.zeros(lmax+1)

# 	for L in xrange(2,lmax+1):
# 		for l in xrange(lmax+1):
# 			for lp in xrange(lmax+1):
# 				print L, l, lp
# 				fact = cltt[l]**2/((cltt[l]+nltt[l])+(cltt[lp]+nltt[lp]))
# 				fact *= (2*l+1)*(2*lp+1)/16./np.pi
# 				# embed()
# 				try:
# 					wig2 = wc.wigner3j(2*L,2*l,2*lp,0.,0.,0.)**2
# 				except:
# 					wig2 = 0.

# 				AlTau[L] += fact * wig2

# 	return np.nan_to_num(1./AlTau)

if __name__ == '__main__':
    Delta_T = 3.  # microK-arcmin
    fwhm = 0.  # arcmin
    lmax = 500

    cosmo = Cosmo()
    cltt = cosmo.cmb_spectra(lmax)[:, 0]
    nltt = nl_cmb(Delta_T, fwhm, lmax=lmax)

    norm = GetAlTau(cltt, nltt, lmax)

    embed()
Esempio n. 3
0
File: chi_r.py Progetto: brycem1/CMB
vec = np.loadtxt(
    '/home/student.unimelb.edu.au/brycem1/MagCAMB/bryce/research12/r_test_vecCls.dat'
)[:, 3]

tens_vec = tens + vec
cl_tens_vec = np.nan_to_num(
    (tens_vec * 2 * np.pi) / (ell_vec * (ell_vec + 1.)))

arcmin2rad = np.pi / 180. / 60.
rad2arcmin = 1. / arcmin2rad
#Camb initialisation
pars = camb.CAMBparams()
data_camb = camb.get_background(pars)

cosmo = Cosmo()
cmbspec = cosmo.cmb_spectra(3000)
#cmbspec_r = Cosmo({'r':0.1}).cmb_spectra(12000,spec='tensor')[:,2]
clbb_r = Cosmo({'r': 1.}).cmb_spectra(3000, spec='tensor')[:, 2]
clbb_r1 = Cosmo({'r': 0.0042}).cmb_spectra(3000, spec='tensor')[:, 2]
clbb_r2 = Cosmo({'r': 0.01}).cmb_spectra(3000, spec='tensor')[:, 2]
clbb_r3 = Cosmo({'r': 0.1}).cmb_spectra(3000, spec='tensor')[:, 2]

#Set up a new set of parameters for CAMB
pars = camb.CAMBparams()
#This function sets up CosmoMC-like settings, with one massive neutrino and helium set using BBN consistency
pars.set_cosmology(H0=67.5,
                   ombh2=0.022,
                   omch2=0.122,
                   mnu=0.06,
                   omk=0,
                   tau=0.06)
Esempio n. 4
0
File: sig_r.py Progetto: brycem1/CMB
import os
import matplotlib.pyplot as plt
from cosmojo.universe import Cosmo
from matplotlib.pyplot import cm
import matplotlib.colors as mcolors

import rotation as ro
import lensing as le

from IPython import embed

arcmin2rad = np.pi / 180. / 60.
rad2arcmin = 1. / arcmin2rad

cosmo = Cosmo()
cmbspec = cosmo.cmb_spectra(5000)
smspec_r = cosmo.cmb_spectra(3000, 'tensor')


#sigma(r=0)
def sig_r0(fsky, BBpowerspectrum, NlBB, lmin=20, lmax=200):
    ell = np.arange(BBpowerspectrum.shape[0])

    summand = ((2. * ell[lmin:lmax + 1] + 1) * fsky /
               2.) * (BBpowerspectrum[lmin:lmax + 1] / NlBB[lmin:lmax + 1])**2.
    return 1.0 / (np.sqrt(np.sum(summand)))


def del_Cl_r(del_r, r0=0.1, lmax=3000):
    cmbspec_ru = Cosmo({'r': r0 + del_r}).cmb_spectra(lmax, spec='tensor')
    cmbspec_rl = Cosmo({'r': r0 - del_r}).cmb_spectra(lmax, spec='tensor')
Esempio n. 5
0
c_cgs = 2.9979E10
e_cgs = 4.8E-10
f_cgs = 70E9
n_B = 2.0
B_l = 10.E-9
Bl = B_l*(1.E9)

data = pickle.load(open("transfer.pkl","rb"))
ell_array = data['ell']
k_array = data['k']
Tl_m1k = data['Tl_m1k']
Tl_p1k = data['Tl_p1k']
T1lk = data['T1lk'] 

cosmo = Cosmo()
cmbspec = cosmo.cmb_spectra(1200)
cmbspec_r = Cosmo({'r':1.}).cmb_spectra(1200,spec='tensor')[:,2]

def GimmeClBBRot(cmbspec, claa, dl=10, n=512, nwanted=100):
	lxgrid, lygrid  = np.meshgrid( np.arange(-n/2.,n/2.)*dl, np.arange(-n/2.,n/2.)*dl )
	lgrid = np.sqrt(lxgrid**2 + lygrid**2)
	L     = np.arange(2,nwanted)*dl    
	
	clee = cmbspec[:,1].copy()
	
	eepowerspec2d = np.interp(lgrid, np.arange(cmbspec.shape[0]), clee)
	
	ell = np.arange(cmbspec.shape[0])
	
					
        #embed()
Esempio n. 6
0
File: r_eff.py Progetto: brycem1/CMB
import numpy as np
from scipy import interpolate
import os
import matplotlib.pyplot as plt
from cosmojo.universe import Cosmo
from matplotlib.pyplot import cm  
import matplotlib.colors as mcolors

import rotation as ro
import lensing as le
import numba

from IPython import embed

arcmin2rad = np.pi / 180. / 60. 
rad2arcmin = 1./arcmin2rad

cosmo = Cosmo()

cmbspec = cosmo.cmb_spectra(5000)
cmbspec_r = Cosmo({'r':1.}).cmb_spectra(210,spec='tensor')[:,2]
l_rot, ClBBRot = ro.GimmeClBBRot(cmbspec,dl=1,nwanted=200)

r_eff = np.sum(ClBBRot[20:200])/np.sum(cmbspec_r[20:200])
embed()