Пример #1
0
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)
Пример #2
0
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)
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')


from hmf import MassFunction
from astropy.cosmology import FlatLambdaCDM
import astropy.units as u
cosmo = FlatLambdaCDM(H0=67.77*u.km/u.s/u.Mpc, Om0=0.307115, Ob0=0.048206)
Пример #4
0
#=======================
# 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')
DS80 = (data["boxName"] == 'DS_8Gpc')

print "ST01 fit MULTIDARK ----------------------"
fw.write('\n')
fw.write('ST01 fit MULTIDARK \n')