def fitZ(zmin, zmax, suffix): NminCount = 100 # 1 percent deviation from mass function given the sigma 8 deviation limits_04 = [125, 450] #max : 2e13#[100, 1000] limits_10 = [250, 800] #max : 2e14 limits_25 = [600, 1100] #max : 5e14 limits_40 = [800, 1400] #max : 2e14 p0 = n.array([A0, v0, a0, b0]) #zmin = -0.01 #zmax = 0.001 #================= # DATA #================= # redshift selection zSel = lib.zSelection(data, zmin, zmax) # mass selection mSel = lib.vSelection(data, qty, limits_04, limits_10, limits_25, limits_40) # minimum number counts selection nSel = lib.nSelection(data, NminCount, cos) # altogether ok = (zSel) & (mSel) & (nSel) # selection per box : # x coordinates definition #================= vmax = data[qty] log_vmax = n.log10(vmax) #print len(vmax), n.min(vmax), n.max(vmax) # y coordinates #================= norm = (100)**3. / (cosmo.H(data["redshift"]).value)**6. log_VF = n.log10(norm * vmax**3. * data["dNdVdlnV_" + cos]) log_VF_c = n.log10(norm * vmax**3. * data["dNdVdlnV_" + cos + "_c"]) #print n.min(log_VF), n.max(log_VF) # error on y position #================= error = (data["std90_pc_" + cos]**2. + data["dN_counts_" + cos]**(-1.))**(0.5) print "n points", len(log_vmax[ok]) if len(log_vmax[ok]) > 50: pOpt, pCov = lib.fit_vmax_function_z0(data[ok], x_data=log_vmax[ok], y_data=log_VF[ok], y_err=error[ok], p0=p0, cos=cos, mode="curve_fit", suffix=suffix)
def fitZ(zmin, zmax, suffix): NminCount = 100 # 1 percent deviation from mass function given the sigma 8 deviation limits_04 = [125, 450] #max : 2e13#[100, 1000] limits_10 = [250, 800] #max : 2e14 limits_25 = [600, 1100] #max : 5e14 limits_40 = [800, 1400] #max : 2e14 p0 = n.array([A0, v0, a0, b0]) #zmin = -0.01 #zmax = 0.001 #================= # DATA #================= # redshift selection zSel = lib.zSelection( data, zmin, zmax ) # mass selection mSel = lib.vSelection(data, qty, limits_04, limits_10, limits_25,limits_40) # minimum number counts selection nSel = lib.nSelection(data, NminCount, cos) # altogether ok = (zSel) & (mSel) & (nSel) # selection per box : # x coordinates definition #================= vmax = data[qty] log_vmax = n.log10(vmax) #print len(vmax), n.min(vmax), n.max(vmax) # y coordinates #================= norm = (100)**3. /(cosmo.H(data["redshift"]).value)**6. log_VF = n.log10( norm * vmax**3. * data["dNdVdlnV_"+cos]) log_VF_c = n.log10( norm * vmax**3. * data["dNdVdlnV_"+cos+"_c"]) #print n.min(log_VF), n.max(log_VF) # error on y position #================= error = (data["std90_pc_"+cos]**2. + data["dN_counts_"+cos]**(-1.))**(0.5) print "n points", len(log_vmax[ok]) if len(log_vmax[ok])>50 : pOpt, pCov = lib.fit_vmax_function_z0(data[ok], x_data = log_vmax[ok], y_data = log_VF[ok], y_err = error[ok], p0 = p0, cos = cos, mode = "curve_fit", suffix = suffix)
limits_10 = n.log10([Npmin*1.51 * 10**9., 5e13]) limits_25 = n.log10([Npmin*2.359 * 10**10., 5e14]) limits_40 = n.log10([Npmin* 9.6 * 10**10. , 5e15]) MPART = n.array([9.63 * 10**7, 1.51 * 10**9, 2.359 * 10**10, 9.6 * 10**10]) zmin = -0.01 zmax = 2.3 #======================= #======================= cos = 'cen' #======================= #======================= # redshift selection zSel = lib.zSelection( data, zmin, zmax ) # mass selection mSel = lib.mSelection(data, qty, limits_04, limits_10, limits_25,limits_40) # minimum number counts selection nSelCen = lib.nSelection(data, NminCount, cos ) # altogether ok = (zSel) & (mSel) & (nSelCen) # selection per box : MD04=(data["boxName"]=='MD_0.4Gpc') MD10=(data["boxName"]=='MD_1Gpc_new_rockS') MD25=(data["boxName"]=='MD_2.5Gpc') MD40=(data["boxName"]=='MD_4Gpc') MD25NW=(data["boxName"]=='MD_2.5GpcNW') MD40NW=(data["boxName"]=='MD_4GpcNW')
#======================= #======================= cos = 'cen' fw.write("c o s=" + cos + '\n') #======================= #======================= # y coordinates ff = mvir * data["dNdlnM_" + cos] / data["rhom"] / abs(data["dlnsigmaMdlnM"]) ff_c = mvir * data["dNdlnM_" + cos + "_c"] / data["rhom"] / abs( data["dlnsigmaMdlnM"]) log_MF = n.log10(ff) log_MF_c = n.log10(ff_c) # redshift selection zSel = lib.zSelection(data, zmin, zmax) # mass selection mSel = lib.mSelection(data, qty, logNpmin) mSel2_inter = (data["log_mvir"] < 13.2) & (data["redshift"] > 0.) mSel2 = (mSel2_inter == False) # minimum number counts selection nSelCen = lib.nSelection(data, NminCount, cos) # altogether ok1 = (zSel) & (mSel) & (mSel2) & (nSelCen) # selection per box : MD04 = (data["boxName"] == 'MD_0.4Gpc') MD10 = (data["boxName"] == 'MD_1Gpc') MD25 = (data["boxName"] == 'MD_2.5Gpc') MD40 = (data["boxName"] == 'MD_4Gpc') MD25NW = (data["boxName"] == 'MD_2.5GpcNW') MD40NW = (data["boxName"] == 'MD_4GpcNW')