level =0.95
cl = int(level*100)


sm=3
histn=3
alpha =0.5




########### r dl and beta

### QUBIC alone
clf()
e=mcmc.matrixplot(chain_E_r_dl_b,['betadust','dldust_80_353','r'], 'pink', sm, limits=[[1.4,2],[12,14.5],[0,0.2]], alpha=alpha,histn=histn, truevals = [truebeta, truedl, truer])
a=mcmc.matrixplot(chain_A_r_dl_b,['betadust','dldust_80_353','r'], 'black', sm, limits=[[1.4,2],[12,14.5],[0,0.2]], alpha=alpha,histn=histn, truevals = [truebeta, truedl, truer])
b=mcmc.matrixplot(chain_B_r_dl_b,['betadust','dldust_80_353','r'], 'brown', sm, limits=[[1.4,2],[12,14.5],[0,0.2]], alpha=alpha,histn=histn, truevals = [truebeta, truedl, truer])
legA = '150x2 : r < {0:5.3f} (95% CL)'.format(upperlimit(chain_A_r_dl_b,'r'))
legB = '150+220 : r < {0:5.3f} (95% CL)'.format(upperlimit(chain_B_r_dl_b,'r'))
legE = '220x2: r < {0:5.3f} (95% CL)'.format(upperlimit(chain_E_r_dl_b,'r'))
legend([a,b,e],[legA, legB, legE], frameon=False, title='QUBIC 2 years ' +site)
savefig('limits_r_beta_dl_qubicalone_'+site+'.png', transparent=True)

### QUBIC + Planck
clf()
f=mcmc.matrixplot(chain_F_r_dl_b,['betadust','dldust_80_353','r'], 'green', sm, limits=[[1.4,2],[12,14.5],[0,0.2]], alpha=alpha,histn=histn, truevals = [truebeta, truedl, truer])
c=mcmc.matrixplot(chain_C_r_dl_b,['betadust','dldust_80_353','r'], 'blue', sm, limits=[[1.4,2],[12,14.5],[0,0.2]], alpha=alpha,histn=histn, truevals = [truebeta, truedl, truer])
d=mcmc.matrixplot(chain_D_r_dl_b,['betadust','dldust_80_353','r'], 'red', sm, limits=[[1.4,2],[12,14.5],[0,0.2]], alpha=alpha,histn=histn, truevals = [truebeta, truedl, truer])
legC = '150x2+353: r < {0:5.3f} (95% CL)'.format(upperlimit(chain_C_r_dl_b,'r'))
legD = '150+220+353: r < {0:5.3f} (95% CL)'.format(upperlimit(chain_D_r_dl_b,'r'))
Example #2
0

clf()
plot(lya['om_ol'],lya['rssqrtomh2'],'k,')
ylim(0,100)

clf()
plot(bao['om_ol'],bao['rssqrtomh2'],'k,')
ylim(0,100)

reload(mcmc)
clf()
vars=['om_ol','rssqrtomh2']
limits=[[0.,3],[0,100]]
doit=[True,True]
a0=mcmc.matrixplot(bao,vars,'yellow',8,limits=limits,doit=doit)
a1=mcmc.matrixplot(lya,vars,'purple',4,limits=limits,doit=doit)
a2=mcmc.matrixplot(lya_bao,vars,'blue',4,limits=limits,doit=doit)
subplot(3,3,3)
axis('off')
legend([a0,a1,a2],['BAO Gal','BAO Lya','All BAO (LRG+Lya)'],title=model)



reload(mcmc)
clf()
vars=['omega_M_0','omega_lambda_0','w','h']
limits=[[0.,0.5],[-0.5,2],[-2,0],[0.,1.5]]
doit=[True,True,False,True]
a0=mcmc.matrixplot(bao,vars,'yellow',8,limits=limits,doit=doit)
a1=mcmc.matrixplot(lya,vars,'purple',4,limits=limits,doit=doit)
######################## OwCDM ################################
model='owcdm'
lya=mcmc.readchains(rep+model+'-'+'LyaDR11_Halone'+ext,add_extra=True)
bao=mcmc.readchains(rep+model+'-'+'BAO'+ext,add_extra=True)
lya_bao=mcmc.readchains(rep+model+'-'+'LyaDR11_Halone+BAO'+ext,add_extra=True)
###################################################



reload(mcmc)
clf()
vars=['omega_M_0', 'omega_lambda_0','c_H0rs']
limits=[[0.,0.5],[0,1.2],[25,35]]
doit=[True,True,True]
a0=mcmc.matrixplot(bao,vars,'yellow',8,limits=limits,doit=doit)
a1=mcmc.matrixplot(lya,vars,'purple',4,limits=limits,doit=doit)
a2=mcmc.matrixplot(lya_bao,vars,'blue',4,limits=limits,doit=doit)
subplot(3,3,3)
axis('off')
legend([a0,a1,a2],['BAO Gal','BAO Lya','All BAO (LRG+Lya)'],title=model)







#### run in a shell
xterm -e python ~/Python/Boss/McMc/mcmc_launcher.py olambdacdm BAO &
xterm -e python ~/Python/Boss/McMc/mcmc_launcher.py olambdacdm LyaDR11_Halone+BAO &
Example #4
0
plot(lll,functsum(lll,np.array([res[0],0])),'b--')
plot(lll,functsum(lll,np.array([0,res[1]])),'b:')
plot(lll,functsum(lll,res2),'r',label='Fit')
plot(lll,functsum(lll,np.array([res2[0],0])),'r--')
plot(lll,functsum(lll,np.array([0,res2[1]])),'r:')
xlabel('$\ell$')
ylabel('$\ell (\ell+1) C_\ell /2\pi$')
legend(loc='upper left')
savefig('newfit_bicep2.png')

from McMc import mcmc

clf()
thechain = {'r':chains[:,0],'A_l':chains[:,1]}
thechain2 = {'r':chains2[:,0],'A_l':chains2[:,1]}
a0=mcmc.matrixplot(thechain2,['r','A_l'],'blue',4,limits=[[0,0.4],[-0.5,3.5]])
a1=mcmc.matrixplot(thechain,['r','A_l'],'red',4,limits=[[0,0.4],[-0.5,3.5]])
subplot(2,2,2)
axis('off')
legend([a1,a0],['BICEP2 Error Bars r = {0:.3f} +/- {1:.3f} <=> {2:.1f}$\sigma$'.format(res[0],err[0],res[0]/err[0]), 'Knox Approx. Error Bars r = {0:.3f} +/- {1:.3f} <=> {2:.1f}$\sigma$'.format(res2[0],err2[0],res2[0]/err2[0])])
savefig('matrixplot_bicep2.png')




####### Fit with Camb models
H0 = 67.04
omegab = 0.022032
omegac = 0.12038
h2 = (H0/100.)**2
scalar_amp = np.exp(3.098)/1.E10
Example #5
0
########### r dl and beta
figure(0)
sm=3
histn=3
alpha =0.5

nbins=100
from scipy.ndimage import gaussian_filter1d
bla = np.histogram(chain_nofg_r['r'],bins=nbins,normed=True)
xhist=(bla[1][0:nbins]+bla[1][1:nbins+1])/2
ss=np.std(chain_nofg_r['r'])
yhist=gaussian_filter1d(bla[0],ss/histn/(xhist[1]-xhist[0]), mode='nearest')
plot(xhist,yhist/max(yhist))

bla=mcmc.matrixplot(chain_B_r_dl_b,['betadust','r'], 'green', sm, limits=[[truebeta*0.95, truebeta*1.05],[0,0.05]], alpha=alpha,histn=histn, truevals = [truebeta, truer])

### Au final
clf()
#c=mcmc.matrixplot(chain_C_r_dl_b,['betadust','r'], 'black', sm, limits=[[truebeta*0.95, truebeta*1.05],[0,0.05]], alpha=alpha,histn=histn, truevals = [truebeta, truer])
b=mcmc.matrixplot(chain_B_r_dl_b,['betadust','r'], 'blue', sm, limits=[[truebeta*0.95, truebeta*1.1],[0,0.07]], alpha=alpha,histn=histn, truevals = [truebeta, truer])
d=mcmc.matrixplot(chain_D_r_dl_b,['betadust','r'], 'red', sm, limits=[[truebeta*0.95, truebeta*1.1],[0,0.07]], alpha=alpha,histn=histn, truevals = [truebeta, truer])
subplot(2,2,4)
noFG = plot(xhist,yhist/max(yhist), color='green', label='toto')
subplot(2,2,2)
#legC = '150x2+353 : r < {0:5.2f} (95% CL)'.format(upperlimit(chain_C_r_dl_b,'r'))
legB = '150+220 : r < {0:5.2f} (95% CL)'.format(upperlimit(chain_B_r_dl_b,'r'))
legD = '150+220+353: r < {0:5.2f} (95% CL)'.format(upperlimit(chain_D_r_dl_b,'r'))
legnoFG = 'No Foregrounds: r < {0:5.2f} (95% CL)'.format(upperlimit(chain_nofg_r,'r'))
legend([b, d, bla],[legB, legD, legnoFG], frameon=False, title='QUBIC 2 years '+config+site)
######################## Ok ################################
model='olambdacdm'
lya_hp1_obh2p1=mcmc.readchains(rep+model+'-'+'LyaDR11_HPlanck1s_obh2Planck1s'+ext,add_extra=True)
lya_hr2_obh2p1=mcmc.readchains(rep+model+'-'+'LyaDR11_HRiess2s_obh2Planck1s'+ext,add_extra=True)
lya_hrp_obh2p1=mcmc.readchains(rep+model+'-'+'LyaDR11_HRiessPlanck_obh2Planck1s'+ext,add_extra=True)

bao_hrp_obh2p1=mcmc.readchains(rep+model+'-'+'BAO_HRiessPlanck_obh2Planck1s'+ext,add_extra=True)
lya_bao_hrp_obh2p1=mcmc.readchains(rep+model+'-'+'LyaDR11_BAO_HRiessPlanck_obh2Planck1s'+ext,add_extra=True)
lya_bao=mcmc.readchains(rep+model+'-'+'LyaDR11+BAO'+ext,add_extra=True)
###################################################

reload(mcmc)
clf()
limits=[[0,1],[0,1.5],[0.6,0.8],[0.021,0.023]]
vars=['omega_M_0','omega_lambda_0','h','obh2']
a2=mcmc.matrixplot(lya_hrp_obh2p1,vars,'red',8,limits=limits,alpha=0.5)
a0=mcmc.matrixplot(lya_hp1_obh2p1,vars,'blue',8,limits=limits,alpha=0.5)
a1=mcmc.matrixplot(lya_hr1_obh2p1,vars,'green',8,limits=limits,alpha=0.5)
subplot(2,2,2)
axis('off')
legend([a0,a1,a2],['BAO Lyman-alpha + h Planck (1s) + Obh2 Planck (1s)',
                   'BAO Lyman-alpha + h Riess (1s) + Obh2 Planck (1s)',
                   'BAO Lyman-alpha + h Riess/Planck + Obh2 Planck (1s)'],title=model)

reload(mcmc)
clf()
limits=[[0.,1],[0,1.5]]
vars=['omega_M_0','omega_lambda_0']
a2=mcmc.matrixplot(lya_hrp_obh2p1,vars,'blue',8,limits=limits,alpha=0.5)
subplot(len(vars),len(vars),len(vars))
axis('off')
Example #7
0
        ########### r dl and beta
        sm=4
        histn=100
        alpha =0.5

        nbins=100
        from scipy.ndimage import gaussian_filter1d
        bla = np.histogram(chain_nofg_r['r'],bins=nbins,normed=True)
        xhist=(bla[1][0:nbins]+bla[1][1:nbins+1])/2
        ss=np.std(chain_nofg_r['r'])
        yhist=gaussian_filter1d(bla[0],20*ss/histn/(xhist[1]-xhist[0]), mode='nearest')
        plot(xhist,yhist/max(yhist))

        thelimits = [[truebeta*0.98, truebeta*1.05],[0,0.03]]

        bla=mcmc.matrixplot(chain_B_r_dl_b,['betadust','r'], 'green', sm, 
            limits=thelimits, alpha=alpha,nbins=histn)#, truevals = [truebeta, truer])

        ### Au final
        clf()
        #c=mcmc.matrixplot(chain_C_r_dl_b,['betadust','r'], 'black', sm, limits=[[truebeta*0.95, truebeta*1.05],[0,0.05]], alpha=alpha,histn=histn, truevals = [truebeta, truer])
        b=mcmc.matrixplot(chain_B_r_dl_b,['betadust','r'], 'blue', sm, limits=thelimits, 
            alpha=alpha,nbins=histn)#, truevals = [truebeta, truer])
        d=mcmc.matrixplot(chain_D_r_dl_b,['betadust','r'], 'red', sm, limits=thelimits, 
            alpha=alpha,nbins=histn)#, truevals = [truebeta, truer])
        subplot(2,2,4)
        noFG = plot(xhist,yhist/max(yhist), color='green', label='toto')
        #subplot(2,2,2)
        #legC = '150x2+353 : r < {0:5.2f} (95% CL)'.format(upperlimit(chain_C_r_dl_b,'r'))
        ul_B = upperlimit(chain_B_r_dl_b,'r', level =0.68)
        legB = '150+220 : $\sigma_r$ = {0:5.3f}'.format(ul_B)
        ul_D = upperlimit(chain_D_r_dl_b,'r', level =0.68)