zcent = (zleft + zright) / 2. xerr = (zright - zleft) / 2. N = Nofzs[np.logical_and(zrange > zleft, zrange <= zright)].sum() print(zcent, N) testcount += N N2 = Nz[np.logical_and(zrange > zleft, zrange <= zright)].sum() currentAxis.add_patch( Rectangle((zcent - xerr + pad, 0), 2 * xerr - pad / 2., N, facecolor=col)) #,alpha=0.5)) #currentAxis.add_patch(Rectangle((zcent - xerr+pad+pad/3., 0), 2*xerr-pad/2., N2, facecolor=col)) pl.add([0, 0], [0, 0], ls='-', linewidth=4, label=expName, color=col) massSense = lndM #*100./np.sqrt(Nmz) massSense = interpolate_grid( massSense, masses, zrange, 10**mexp_new, z_new, regular=True) #,kind="cubic",bounds_error=False,fill_value=np.inf) print((massSense.shape), testcount) fsense = massSense / np.sqrt(rn) pl.legend(labsize=9, loc='upper right') pl._ax.set_ylim(1, 5.e4) # fsky pl._ax.set_xlim(0., 3.) pl.done(outDir + "clNofz.pdf") fsense[fsense > 10.] = np.nan from orphics.io import Plotter import os mmin = mgrid.min() mmax = mgrid.max() zmin = zgrid.min()
HMF = Halo_MF(cc,Mexp,zbin) dvdz = HMF.dVdz#(zbin) dndm = HMF.N_of_z_SZ(fsky,SZProf) sys.exit() print(("Time for N of z " , time.time() - start3)) # pl = Plotter() # pl.add(zbin[1:], dndm * dvdz[1:]) # pl.done("output/dndm.png") print(("Total number of clusters ", np.trapz(dndm ,zbin[:],np.diff(zbin[:]))*fsky)) #np.savetxt('output/dndm_dVdz_1muK_3_0arc.txt',np.transpose([zbin[1:],dndm,dvdz[1:]])) mfile = "data/S4-7mCMB_all.pkl" minrange, zinrange, lndM = pickle.load(open(mfile,'rb')) outmerr = interpolate_grid(lndM,minrange,zinrange,Mexp,zbin,regular=False,kind="cubic",bounds_error=False,fill_value=np.inf) q_arr = np.logspace(np.log10(6.),np.log10(500.),64) dnqmz = HMF.N_of_mqz_SZ(outmerr,q_arr,SZProf) N,Nofz = getTotN(dnqmz,Mexp,zbin,q_arr,returnNz=True) print((N*fsky))