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)
zmax = 1. cos = "cen" tolerance = 0.06 #================= # DATA #================= # loads summary file data = fits.open( join(dir, "MD_"+qty+"_summary.fits"))[1].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 : 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') # x coordinates definition #=================
# loads summary file data = fits.open(join(dir, "MD_" + qty + "_summary.fits"))[1].data NminCount = 100 limits_04 = [125, 450] #max : 2e13#[100, 1000] limits_10 = [250, 800] #max : 2e14 limits_25 = [600, 1100] #max : 5e14 limits_40 = [900, 1400] #max : 2e14 zmin = 1. # -0.01 zmax = 2.3 # 1.0 # 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 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') MD25 = (data["boxName"] == 'MD_2.5Gpc') MD40 = (data["boxName"] == 'MD_4Gpc') MD25NW = (data["boxName"] == 'MD_2.5GpcNW') MD40NW = (data["boxName"] == 'MD_4GpcNW') # x coordinates definition vmax = data[qty] log_vmax = n.log10(data[qty])