コード例 #1
0
ファイル: mcmc.py プロジェクト: jchamilton75/MySoft
def get_rs_values(data):
    nn=len(data['h'])
    rs=np.zeros(nn)
    mycosmo=cosmolopy.fidcosmo.copy()
    mycosmo['Y_He']=0.247710
    mycosmo['n']=0.9619123
    mycosmo['omega_n_0']=0
    mycosmo['Num_Nu_massless']=3.046/3*2
    mycosmo['Num_Nu_massive']=3.046/3
    if 'w' in data.keys():
        wvals=data['w']
    else:
        wvals=np.zeros(nn)-1
        
    for i in np.arange(nn):
        cosmo_utils.progress_bar(i,nn)
        mycosmo['h']=data['h'][i]
        mycosmo['omega_M_0']=data['omega_M_0'][i]
        mycosmo['omega_lambda_0']=data['omega_lambda_0'][i]
        mycosmo['omega_k_0']=data['omega_k_0'][i]
        mycosmo['omega_b_0']=data['omega_b_0'][i]
        mycosmo['w']=wvals[i]
        rs[i]=cosmo_utils.rs(**mycosmo)

    return(rs)
コード例 #2
0
def my_da_rs(h=h,om=om,w=w,ob=ob):
    cosmo=cosmolopy.fidcosmo.copy()
    cosmo['h']=h
    cosmo['omega_M_0']=om
    cosmo['omega_lambda_0']=1.-om
    cosmo['omega_k_0']=0.
    cosmo['omega_b_0']=ob
    cosmo['w']=w
    #cosast=astropy.cosmology.wCDM(cosmo['h']*100,cosmo['omega_M_0'],cosmo['omega_lambda_0'],w0=cosmo['w'])
    try:
        daval=cosmo_utils.angdist(zlya,**cosmo)
        #daval=cosmolopy.distance.angular_diameter_distance(zlya,**cosmo)
        #daval=cosast.angular_diameter_distance(zlya)
    except ValueError:
        daval=-1.
    rsval=cosmo_utils.rs(**cosmo)
    theda_rs=daval/rsval
    return(theda_rs)
コード例 #3
0
def my_invhrs(h=h,om=om,w=w,ob=ob):
    cosmo=cosmolopy.fidcosmo.copy()
    cosmo['h']=h
    cosmo['omega_M_0']=om
    cosmo['omega_lambda_0']=1.-om
    cosmo['omega_k_0']=0.
    cosmo['omega_b_0']=ob
    cosmo['w']=w
    #cosast=astropy.cosmology.wCDM(cosmo['h']*100,cosmo['omega_M_0'],cosmo['omega_lambda_0'],w0=cosmo['w'])
    try:
        hval=cosmo_utils.e_z(zlya,**cosmo)*cosmo['h']
        #hval=cosmolopy.distance.e_z(zlya,**cosmo)*cosmo['h']
        #hval=cosmo['h']/cosast.inv_efunc(zlya)
    except ValueError:
        hval=-1.
    rsval=cosmo_utils.rs(**cosmo)
    theinvhrs=1./(hval*rsval)
    return(theinvhrs)
コード例 #4
0
ファイル: model_lyaDR11.py プロジェクト: jchamilton75/MySoft
def theproba_ext(h=h,om=om,ol=ol,ob=ob):
    cosmo=cosmolopy.fidcosmo.copy()
    cosmo['h']=h
    cosmo['omega_M_0']=om
    cosmo['omega_lambda_0']=ol
    cosmo['omega_k_0']=1.-om-ol
    cosmo['omega_b_0']=ob
    try:
        daval=cosmolopy.distance.angular_diameter_distance(zlya,**cosmo)
    except ValueError:
        daval=-1.
    try:
        hval=cosmolopy.distance.e_z(zlya,**cosmo)*cosmo['h']
    except ValueError:
        hval=-1.
    rsval=cosmo_utils.rs(**cosmo)
    invhrs=1./(hval*rsval)
    da_rs=daval/rsval
    valprob=proba_interp(invhrs,da_rs)
    #print(h.flatten()[0],om.flatten()[0],ol.flatten()[0],ob.flatten()[0],'   ',invhrs,da_rs,valprob)
    return(valprob,invhrs,da_rs)
コード例 #5
0
def thelogproba_ext(h=h,om=om,w=w,ob=ob):
    cosmo=cosmolopy.fidcosmo.copy()
    cosmo['h']=h
    cosmo['omega_M_0']=om
    cosmo['omega_lambda_0']=1.-om
    cosmo['omega_k_0']=0.
    cosmo['omega_b_0']=ob
    cosmo['w']=w
    try:
        daval=cosmo_utils.angdist(zlya,**cosmo)
    except ValueError:
        daval=-1.
    try:
        hval=cosmo_utils.e_z(zlya,**cosmo)*cosmo['h']
    except ValueError:
        hval=-1.
    rsval=cosmo_utils.rs(**cosmo)
    invhrs=1./(hval*rsval)
    da_rs=daval/rsval
    vallogprob=logproba_interp(invhrs,da_rs)
    return(vallogprob,invhrs,da_rs)
コード例 #6
0
ファイル: model_lyaDR11.py プロジェクト: jchamilton75/MySoft
plot(apar1d*0+1,aper1d,'k:')
plot(aparmin,apermin,'ro')

### fiducial cosmo
zlya=2.46
mycosmo=cosmolopy.fidcosmo.copy()
mycosmo['baryonic_effects']=True
mycosmo['h']=0.7
mycosmo['omega_M_0']=0.27
mycosmo['omega_lambda_0']=0.73
mycosmo['omega_k_0']=0.
mycosmo['w']=-1.0
mycosmo['omega_b_0']=0.0227/mycosmo['h']**2
da_fidu=cosmolopy.distance.angular_diameter_distance(zlya,**mycosmo)
h_fidu=cosmolopy.distance.e_z(zlya,**mycosmo)*mycosmo['h']
rs_fidu=cosmo_utils.rs(**mycosmo)
hrs_fidu=h_fidu*rs_fidu
da_rs_fidu=da_fidu/rs_fidu

X_hrs=apar1d/hrs_fidu
Yda_rs=aper1d*da_rs_fidu
X_hrs_min=aparmin/hrs_fidu
Yda_rs_min=apermin*da_rs_fidu
newdx=dx/hrs_fidu
newdy=dy*da_rs_fidu
proba=proba/np.sum(proba)/newdx/newdy

clf()
xlabel('$1/(H r_s)$')
ylabel('$D_A/r_s$')
imshow(transpose(proba/np.max(proba)),extent=(np.min(X_hrs)-newdx/2,np.max(X_hrs)+newdx/2,np.min(Yda_rs)-newdy/2,np.max(Yda_rs)+newdy/2),origin='lower',interpolation='nearest',aspect='auto')
コード例 #7
0
ファイル: plots_bao.py プロジェクト: jchamilton75/MySoft
######## TESTS #########################
reload(cosmo_utils)
mycosmo=L.mycosmo.copy()
mycosmo['baryonic_effects']=True
mycosmo['h']=0.7
mycosmo['omega_M_0']=0.27
mycosmo['omega_lambda_0']=0.73
mycosmo['omega_k_0']=0.
mycosmo['w']=-1.0
mycosmo['omega_b_0']=0.0227/mycosmo['h']**2
mycosmo['omega_n_0']=0
mycosmo['Num_Nu_massless']=3.046
mycosmo['Num_Nu_massive']=0

print(L.rs_fidu)
print(cosmo_utils.rs(**mycosmo))
print(cosmo_utils.rs_zstar_camb(**mycosmo))
print(cosmo_utils.rs_zdrag_camb(**mycosmo))
print(cosmo_utils.rs_zdrag_fast_camb(**mycosmo))

cosmoplanck=L.mycosmo.copy()
cosmoplanck['h']=0.6704
cosmoplanck['Y_He']=0.247710
obh2=0.022032
onh2=0.000645
och2=0.120376-onh2
cosmoplanck['omega_M_0']=(och2+obh2+onh2)/cosmoplanck['h']**2
cosmoplanck['omega_lambda_0']=1.-cosmoplanck['omega_M_0']
cosmoplanck['omega_k_0']=0
cosmoplanck['omega_b_0']=obh2/cosmoplanck['h']**2
cosmoplanck['omega_n_0']=onh2/cosmoplanck['h']**2