Skip to content

Commit 9f37b1e

Browse files
committed
fixing ksz
1 parent 29ec48a commit 9f37b1e

File tree

2 files changed

+11
-22
lines changed

2 files changed

+11
-22
lines changed

src/profiles_tau.jl

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,12 @@ function get_params(::AbstractBattagliaTauProfile{T}, M_200c, z) where T
3535
m = M_200c / (1e14M_sun)
3636
P₀ = 4.e3 * m^0.29 * z₁^(-0.66)
3737
α = 0.88 * m^(-0.03) * z₁^0.19
38-
β = -3.83 * m^0.04 * z₁^(-0.025)
38+
β = 3.83 * m^0.04 * z₁^(-0.025)
3939
xc = 0.5
4040
γ = -0.2
4141
return (xc=T(xc), α=T(α), β=T(β), γ=T(γ), P₀=T(P₀))
4242
end
4343

44-
function ρ_crit_comoving_h⁻²(model, z)
45-
return (ρ_crit(model, z) ) / (1+z)^3 / model.cosmo.h^2
46-
end
47-
48-
function r200c_comoving(model, M_200c, z)
49-
rho_crit = ρ_crit(model, z) / (1+z)^3
50-
return cbrt(M_200c/ (4π/3 * rho_crit * 200))
51-
end
52-
53-
5444
# if angular, return the R200 size in radians
5545
function object_size(model::BattagliaTauProfile{T,C}, physical_size, z) where {T,C}
5646
d_A = angular_diameter_dist(model.cosmo, z)
@@ -68,12 +58,11 @@ end
6858
# returns a density, which we can check against Msun/Mpc²
6959
function rho_2d(model::AbstractBattagliaTauProfile, r, m200c, z)
7060
par = get_params(model, m200c, z)
71-
r200c = R_Δ(model, m200c, z, 200)
61+
r200c = R_Δ(model, m200c, z, 200) # this is physical units
7262
X = r / object_size(model, r200c, z) # either ang/ang or phys/phys
73-
rho_crit = ρ_crit_comoving_h⁻²(model, z) # need to sort this out, it's all in comoving...
74-
result = par.P₀ * XGPaint._nfw_profile_los_quadrature(X, par.xc, par.α, par.β, par.γ)
75-
76-
return result * rho_crit * (r200c * (1+z))
63+
rho_crit = ρ_crit(model, z) # this is physical units
64+
rho_fit = par.P₀ * XGPaint._nfw_profile_los_quadrature(X, par.xc, par.α, par.β, par.γ) # dimensionless _nfw_profile_los_quadrature comes from profiles_y.jl TODO move
65+
return rho_fit * model.f_b * rho_crit * r200c # mistake in battaglia 2016: need f_b to convert from m to gas. note r200c due to integral over X
7766
end
7867

7968
function ne2d(model::AbstractBattagliaTauProfile, r, m200c, z)
@@ -83,8 +72,8 @@ function ne2d(model::AbstractBattagliaTauProfile, r, m200c, z)
8372
xH = 0.76
8473
nH_ne = 2xH / (xH + 1)
8574
nHe_ne = (1 - xH)/(2 * (1 + xH))
86-
factor = (me + nH_ne*mH + nHe_ne*mHe) / model.cosmo.h^2
87-
result = rho_2d(model, r, m200c, z) # (Msun/h) / (Mpc/h)^2
75+
factor = (me + nH_ne*mH + nHe_ne*mHe)
76+
result = rho_2d(model, r, m200c, z) # (Msun) / (Mpc)^2
8877
return result / factor
8978
end
9079

src/profiles_y.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ end
3131

3232
function generalized_nfw(x, xc, α, β, γ)
3333
= x / xc
34-
return^γ * (1 +^α)^((β - γ) / α)
34+
return^γ * (1 +^α)^(-+ γ) / α) # correction to battaglia 2016 tau.
3535
end
3636

3737
function _generalized_scaled_nfw(x̄, α, β, γ)
38-
return^γ * (1 +^α)^((β - γ) / α)
38+
return^γ * (1 +^α)^(-+ γ) / α)
3939
end
4040

4141

@@ -47,11 +47,11 @@ function get_params(::AbstractGNFW{T}, M_200, z) where T
4747
β = 4.35 * m^0.0393 * z₁^0.415
4848
α = 1
4949
γ = -0.3
50-
β = γ - α * β # Sigurd's conversion from Battaglia to standard NFW
50+
β = - γ - α * β # to match bataglia form.
5151
return (xc=T(xc), α=T(α), β=T(β), γ=T(γ), P₀=T(P₀))
5252
end
5353

54-
function _nfw_profile_los_quadrature(x, xc, α, β, γ; zmax=1e5, rtol=eps(), order=9)
54+
function _nfw_profile_los_quadrature(x, xc, α, β, γ; zmax=1e5, rtol=eps(), order=9) # FIXME put zmax back to 1e5?
5555
= x^2
5656
scale = 1e9
5757
integral, err = quadgk(y -> scale * generalized_nfw((y^2 + x²), xc, α, β, γ),

0 commit comments

Comments
 (0)