a = 0 for datasets in datasetl: b = 0 for params in params_1D: b += 1 pylab.subplot(1, len(params_1D), b) C = cosmochain(dire + model_1D + '_' + datasets, 'auto') C = ChainIterator('chains_140411_155701', 'LCDM', 'phy', 'BBAO+CMBP') grlist = [] wlist = [] for i in range(0, C.N, 1000): T = C.theory(i) grlist.append(T.growth(10.0)) wlist.append(C.weight(i)) grlist = array(grlist) wlist = array(wlist) mn = (grlist * wlist).sum() / wlist.sum() er = sqrt((grlist**2 * wlist).sum() / wlist.sum() - mn**2) print("growth z=10/z=0 = ", mn, "+/-", er) a += 1 xx, yy = C.GetHisto(params, NormPeak=True, nbins=NBins_1D) pylab.plot(xx, yy, colour(a), label=cosmodata(datasets)) if 'True' in xrange: xmin = "xmin_" + str(b) xmax = "xmax_" + str(b) pylab.xlim(eval(xmin), eval(xmax))
#fname=self.get_filename(dire,model,extra,dataset) C=cosmochain(dire+ model_1D+'_'+datasets,'auto') if(True): #Compute functions= ratio of Fig 2 at z=0.57/0 dire2 = 'chains/DR12/' D=ChainIterator(dire2, 'LCDM','phy', 'CombBAOzb3') grlist=[] wlist=[] for i in range(0,D.N,1000): T=D.theory(i) #grlist.append(T.Da_z(0.57)/T.Hinv_z(0)/(1.0*N.log(1.57))) #grlist.append(T.DaOverrd(0.51)) grlist.append(T.HIOverrd(0.61)) wlist.append(D.weight(i)) grlist=array(grlist) wlist=array(wlist) mn=(grlist*wlist).sum()/wlist.sum() er=sqrt((grlist**2*wlist).sum()/wlist.sum()-mn**2) #print "H(0.0)/(1.0) \over c*ln(1.57)/D_m(0.57) = ",mn,"+/-",er print "z = 0.38 = ",mn,"+/-",er a+=1 xx,yy=C.GetHisto(params,NormPeak=True,nbins=NBins_1D) pylab.plot(xx, yy, colour(a), label=cosmodata(datasets)) if 'True' in xrange: xmin="xmin_"+str(b) xmax="xmax_"+str(b)
if 'True' in Plot_1D: a=0 for datasets in datasetl: b=0 for params in params_1D: b+=1 pylab.subplot(1,len(params_1D),b) C=cosmochain(dire+ model_1D+'_'+datasets,'auto') C=ChainIterator('chains_140411_155701','LCDM','phy','BBAO+CMBP') grlist=[] wlist=[] for i in range(0,C.N,1000): T=C.theory(i) grlist.append(T.growth(10.0)) wlist.append(C.weight(i)) grlist=array(grlist) wlist=array(wlist) mn=(grlist*wlist).sum()/wlist.sum() er=sqrt((grlist**2*wlist).sum()/wlist.sum()-mn**2) print "growth z=10/z=0 = ",mn,"+/-",er a+=1 xx,yy=C.GetHisto(params,NormPeak=True,nbins=NBins_1D) pylab.plot(xx, yy, colour(a), label=cosmodata(datasets)) if 'True' in xrange: xmin="xmin_"+str(b)
import numpy as np #from RunBase import * #from cosmich import * from ChainIterator import * if (True): #Compute functions= ratio of Fig 2 at z=0.57/0 dire2 = '/astro/u/jvazquez/work/SimpleMC/trunk/chains/' D = ChainIterator(dire2, 'FCDM', 'phy', 'Planck_15+BBAO+SN', balance=False) grlist = [] wlist = [] with open('my_data.txt', 'w') as g: for i in range(0, D.N, 2000): T = D.theory(i) z = [j for j in np.arange(-0.9, 4, 0.2)] wde = [T.w_de(j) for j in np.arange(-0.9, 4, 0.2)] ll = len(z) t = (D.weight(i), ) + tuple(z) + tuple(wde) g.write(str('%2.5e\t' * (2 * ll + 1) % (t))) g.write('\n')
zval = 2.0 for model in modell: outfile = 'chains/' + model + '_' + z + '_' + extra + '_' + data fout = open(outfile + "_1.txt", 'w') formstr = '%g ' * (6) + '\n' C = ChainIterator(dire, model, extra, data, balance=False) grlist = [] wlist = [] for i in range(0, C.N, 400): T = C.theory(i) outstr = formstr % tuple([ C.weight(i), 0.5 * C.chi2(i), C.pvalue(i, 'h'), C.pvalue(i, 'Om'), C.pvalue(i, 'lambda'), T.Om_z(1.0 / (1 + zval)) ]) fout.write(outstr) fout.flush() #print C.chi2(i), C.weight(i), C.pvalue(i,'h'), T.Om_z(0.5) grlist.append(T.Om_z(0.5)) wlist.append(C.weight(i)) fout.close() grlist = array(grlist) wlist = array(wlist) mn = (grlist * wlist).sum() / wlist.sum()
import numpy as np #from RunBase import * #from cosmich import * from ChainIterator import * if(True): #Compute functions= ratio of Fig 2 at z=0.57/0 dire2 = '/astro/u/jvazquez/work/SimpleMC/trunk/chains/' D=ChainIterator(dire2, 'FCDM','phy', 'Planck_15+BBAO+SN', balance =False) grlist=[] wlist=[] with open('my_data.txt', 'w') as g: for i in range(0,D.N,2000): T=D.theory(i) z = [j for j in np.arange(-0.9,4,0.2)] wde = [T.w_de(j) for j in np.arange(-0.9,4,0.2)] ll = len(z) t = (D.weight(i),) + tuple(z) + tuple(wde) g.write(str('%2.5e\t'*(2*ll+1)%(t))) g.write('\n')