def bias_numerator_integrand(logm, a, delta, cd) : import cosmocalc import numpy as np ## Set the cosmocalc cosmology cosmocalc.set_cosmology(cd) ## Need the mass in the integral, not the log10(mass) m = np.power(10., logm) ## Return the integrand return cosmocalc.tinker2010_mass_function(m, a, delta)*\ cosmocalc.tinker2010_bias(m, a, delta)*m
def get_bG(cosmo_dict, a, Masses): return cc.growth_function(a)*np.array([cc.tinker2010_bias(Mi, a, 200) for Mi in Masses])
#Set up cosmocalc ombh2, omch2, w0, ns, ln10As, H0, Neff, sigma8 = test_cosmo h = H0 / 100. Ob = ombh2 / h**2 Om = Ob + omch2 / h**2 cosmo_dict = {"om":Om,"ob":Ob,"ol":1-Om,\ "ok":0.0,"h":h,"s8":sigma8,\ "ns":ns,"w0":w0,"wa":0.0} cc.set_cosmology(cosmo_dict) #Used to create the splines in cosmocalc #Get the biases bias = np.zeros_like(lM) a = 1. / (1 + redshifts[z_index]) for i in xrange(0, len(lM)): M = 10**lM[i] bias[i] = cc.tinker2010_bias(M, a, 200) #Get sigmaR R = (3. / 4. / np.pi * volume)**(1. / 3.) sigmaR = cc.sigmaRtophat_exact(R, a) print sigmaR**2 for i in xrange(0, len(bias)): for j in xrange(0, len(bias)): if i == j: continue cov_an[i, j] = bias[i] * bias[j] * N_emu[i] * N_emu[j] * sigmaR**2 continue continue print cov_an[0] import matplotlib.pyplot as plt
z = redshifts[zind] a = scale_factors[zind] sigmaR = cc.sigmaRtophat_exact(R,a) #Read in the data MF_data = np.genfromtxt("../../all_MF_data/building_MF_data/full_mf_data/Box%03d_full/Box%03d_full_Z%d.txt"%(box,box,zind)) lM_bins = MF_data[:,:2] lM = np.mean(lM_bins,1) N_data = MF_data[:,2] N_data_array.append(N_data) logN_data_array.append(np.log(N_data)) #Get the biases bias = np.zeros_like(lM) for i in xrange(0,len(bias)): bias[i] = cc.tinker2010_bias(10**lM[i],a,200) #Predict the TMF n = mf_emulator.predict_mass_function(test_cosmo,redshift=z,lM_bins=lM_bins) N_emu = n*volume N_emu_array.append(N_emu) logN_emu_array.append(np.log(N_emu)) #Make the covariance matrix cov_emu = np.diag(N_emu) logcov_emu = np.diag(1./N_emu) for i in xrange(0,len(lM)): for j in xrange(0,len(lM)): cov_emu[i,j] += bias[i]*bias[j]*N_emu[i]*N_emu[j]*sigmaR**2 logcov_emu[i,j] += bias[i]*bias[j]*sigmaR**2 continue #end i