Beispiel #1
0
// Rho calcualtes the density of the halo's dark matter at radius r. The
// returned value is in cosmological units.
func (h *Halo) Rho(bt BiasType, r float64) float64 {
	switch bt {
	case Biased:
		m := func(r float64) float64 { return h.MassEnclosed(bt, r) }
		return num.Derivative(m, r)(r) / (4 * math.Pi * r * r)
	case Corrected:
		rH, mH, c := h.C500.R, h.C500.M, h.C500.C
		ampl := mH * c * c * c / (4.0 * math.Pi * rH * rH * rH * mNFW(c))
		x := r / h.Rs
		return ampl / (x * (1.0 + x) * (1.0 + x))
	}
	panic("Unrecognized BiasType.")
}
Beispiel #2
0
// DPdr calculates the derivative the halo's pressure profile with respect
// to radius. The returned quantity is in MKS units.
func (h *Halo) DPdr(pbt PressureBiasType, ppt PressureProfileType, pt PressurePopulationType, r float64) float64 {
	p := func(r float64) float64 { return h.Pressure(pbt, ppt, pt, r) }
	return num.Derivative(p, r)(r) / cosmo.MpcMks
}
Beispiel #3
0
func BetaBiasFunc(fTh RadialFuncType) RadialFuncType {
	return func(h *Halo, r float64) float64 {
		fThR := func(r float64) float64 { return fTh(h, r) }
		return num.Derivative(fThR, r)(r) * r / fThR(r)
	}
}