Config = SafeConfigParser() Config.optionxform = str Config.read(iniFile) #cls = np.loadtxt("data/Nov10_highAcc_CDM_lensedCls.dat") cls = np.loadtxt("data/highell_lensedCls.dat") print((cls.shape)) ells = np.arange(0, cls.shape[0]) cltt = cls[:, 1] fwhm = 18. / 60. rms_noise = 0.1 nls = cmb.noise_func(ells, fwhm, rms_noise, TCMB=1.) * ells * (ells + 1.) / 2. / np.pi lcross = ells[nls > cltt][0] print(lcross) pl = io.Plotter(scaleY='log', scaleX='log') pl.add(ells, cltt) pl.add(ells, nls) pl._ax.axvline(x=lcross) pl.done("cls.png") lmax = 60000 #cambRoot = "data/Nov10_highAcc_CDM" #cambRoot = "data/highell" #clist = ["data/highell","data/highell_hf5","data/Nov10_highAcc_CDM"]
import numpy as np import orphics.tools.cmb as cmb import orphics.tools.io as io fwhm = 0. #1.4 # beam convolved noise rms_noise = 35.0 lknee = 2000. alpha = -4.7 ell_fit = 5000. lknee_guess = 500. alpha_guess=-1.0 ells = np.arange(100.,8000.,30) nls = cmb.noise_func(ells,fwhm,rms_noise,lknee,alpha)#*cmb.gauss_beam(ells,fwhm)**2. nls += nls*np.random.normal(0.,0.05,size=nls.size) pl = io.Plotter(scaleY='log') pl.add(ells,nls*ells**2.) noise_guess,lknee_fit,alpha_fit = cmb.fit_noise_power(ells,nls,ell_fit,lknee_guess,alpha_guess) fit_nls = cmb.noise_func(ells,fwhm,noise_guess,lknee_fit,alpha_fit)#*cmb.gauss_beam(ells,fwhm)**2. pl.add(ells,fit_nls*ells**2.,ls="--") pl.done("noisetest.png")
f_nu_arr = f_nu(cc.c,np.array(freqs)) #print "TEST", np.sum(f_nu_arr - f_nu_arr2) #print fq_mat #print fq_mat_t radio_mat = old_div(fgs.rad_ps(print_ells[4],fq_mat,fq_mat_t), cc.c['TCMBmuK']**2.) #print "contraction", np.dot(np.transpose(f_nu_arr),np.dot(np.linalg.inv(radio_mat),f_nu_arr)) #print fgs.rad_ps(ls[10],fq_mat_t,fq_mat)/ls[10]/(ls[10]+1.)*2.*np.pi/ cc.c['TCMBmuK']**2. #print fgs.rad_ps(ls[10],fq_mat_t,fq_mat)*0.0 + 1. print(("noise", old_div(noise_func(print_ells[4],np.array(beams),np.array(noises),lknee,alpha,dimensionless=False), cc.c['TCMBmuK']**2.))) fac_norm = ls*(ls+1.)/(2.*np.pi) * cc.c['TCMBmuK']**2 for fwhm,noiseT,testFreq in zip(beams,noises,freqs): totCl = 0. #print testFreq noise = old_div(noise_func(ls,fwhm,noiseT,lknee,alpha,dimensionless=False), cc.c['TCMBmuK']**2.) radio = fgs.rad_ps(ls,testFreq,testFreq)/ls/(ls+1.)*2.*np.pi/ cc.c['TCMBmuK']**2. cibp = fgs.cib_p(ls,testFreq,testFreq) /ls/(ls+1.)*2.*np.pi/ cc.c['TCMBmuK']**2. cibc = fgs.cib_c(ls,testFreq,testFreq)/ls/(ls+1.)*2.*np.pi/ cc.c['TCMBmuK']**2. tsz = fgs.tSZ(ls,testFreq,testFreq)/ls/(ls+1.)*2.*np.pi/ cc.c['TCMBmuK']**2. tsz_cib = np.abs(fgs.tSZ_CIB(ls,testFreq,testFreq)/ls/(ls+1.)*2.*np.pi/ cc.c['TCMBmuK']**2.) pol_dust = fgs.gal_dust_pol(ls,testFreq,testFreq) /ls/(ls+1.)*2.*np.pi/ cc.c['TCMBmuK']**2.
beam = listFromConfig(Config, expName, 'beams') noise = listFromConfig(Config, expName, 'noises') freq = listFromConfig(Config, expName, 'freqs') lkneeT, lkneeP = listFromConfig(Config, expName, 'lknee') alphaT, alphaP = listFromConfig(Config, expName, 'alpha') print((expName, beam, noise, lkneeT, lkneeP, alphaT, alphaP)) ind = np.where(np.isclose(freq, freq_to_use)) beamFind = np.array(beam)[ind] noiseFind = np.array(noise)[ind] nls = cmb.noise_func(ells, beamFind, noiseFind, lknee=lkneeT, alpha=alphaT, dimensionless=False) pl.add(ells, nls * ells**2., label=lab) lkneeT = 1000. nls = cmb.noise_func(ells, beamFind, noiseFind, lknee=lkneeT, alpha=alphaT, TCMB=TCMB) pl.add(ells, nls * ells**2., label='S4 1arc lknee=1000', alpha=0.5, ls="--") lkneeT = 3000. nls = cmb.noise_func(ells,