示例#1
0
func initCorrectedHalo(h *Halo, cFunc num.Func1D, m500cCorrect float64) {
	rho500c := cosmo.RhoCritical(h.Z) * 500

	h.C500.M = m500cCorrect
	h.C500.R = haloRadius(h.C500.M, rho500c)
	initSearching(h, cFunc, h.C500.M, h.C500.R)

	// initDensityInfo may require that r500cBias and m500cBias be initialized.
	if h.ppt.RequiresBiasedMass() {
		// initial guess
		h.M500cBias = h.C500.M
		h.R500cBias = h.C500.R

		r500cBiasLhs := func(r500cBias float64) float64 { return r500cBias }
		r500cBiasRhs := func(r500cBias float64) float64 {
			h.R500cBias = r500cBias
			h.M500cBias = haloMass(r500cBias, rho500c)
			return h.OverdensityRadius(Biased, rho500c)
		}

		h.R500cBias = num.FindEqual(r500cBiasLhs, r500cBiasRhs,
			h.C500.R/2, h.C500.R)
		h.M500cBias = haloRadius(h.R500cBias, rho500c)
	}

	initDensityInfo(h, cFunc, h.C500.M, h.C500.R)

	h.R500cBias = h.OverdensityRadius(Biased, rho500c)
	h.M500cBias = haloMass(h.R500cBias, rho500c)
}
示例#2
0
func initBiasedHalo(h *Halo, cFunc num.Func1D, m500cBias float64) {
	rho500c := 500 * cosmo.RhoCritical(h.Z)

	h.R500cBias = haloRadius(m500cBias, rho500c)
	h.M500cBias = m500cBias

	bFracLhs := func(b float64) float64 { return b }
	bFracRhs := func(b float64) float64 {
		initSearching(h, cFunc, b*h.M500cBias, h.R500cBias)
		h.C500.R = h.OverdensityRadius(Corrected, rho500c)
		h.C500.M = haloMass(h.C500.R, rho500c)

		return h.BFrac(h.R500cBias)
	}

	// h.BFrac evaluated at r500cBias
	b := num.FindEqual(bFracLhs, bFracRhs, 1.0, 2.0)

	mR500cBias := m500cBias * b
	initDensityInfo(h, cFunc, mR500cBias, h.R500cBias)
}