diff --git a/tests/test_theory.py b/tests/test_theory.py index 9e4771b32..d93c39f18 100644 --- a/tests/test_theory.py +++ b/tests/test_theory.py @@ -345,52 +345,71 @@ def test_profiles(modeling_data, profile_init): if mod.backend == "nc": assert_allclose( mod.eval_surface_density( - cfg["SIGMA_PARAMS"]["r_proj"], cfg["SIGMA_PARAMS"]["z_cl"], r_mis=0.1, - verbose=True)[-40:], + cfg["SIGMA_PARAMS"]["r_proj"], + cfg["SIGMA_PARAMS"]["z_cl"], + r_mis=0.1, + verbose=True, + )[-40:], cfg["numcosmo_profiles"]["Sigma"][-40:], 2.5e-2, ) assert_allclose( mod.eval_surface_density( - cfg["SIGMA_PARAMS"]["r_proj"], cfg["SIGMA_PARAMS"]["z_cl"], r_mis=0.1, - verbose=True, mis_from_backend=True)[-40:], + cfg["SIGMA_PARAMS"]["r_proj"], + cfg["SIGMA_PARAMS"]["z_cl"], + r_mis=0.1, + verbose=True, + mis_from_backend=True, + )[-40:], cfg["numcosmo_profiles"]["Sigma"][-40:], 2.5e-2, ) assert_allclose( mod.eval_mean_surface_density( - cfg["SIGMA_PARAMS"]["r_proj"], cfg["SIGMA_PARAMS"]["z_cl"], r_mis=0.1, - verbose=True)[-40:], + cfg["SIGMA_PARAMS"]["r_proj"], + cfg["SIGMA_PARAMS"]["z_cl"], + r_mis=0.1, + verbose=True, + )[-40:], (cfg["numcosmo_profiles"]["Sigma"] + cfg["numcosmo_profiles"]["DeltaSigma"])[-40:], 8.5e-3, ) assert_allclose( mod.eval_mean_surface_density( - cfg["SIGMA_PARAMS"]["r_proj"], cfg["SIGMA_PARAMS"]["z_cl"], r_mis=0.1, - verbose=True, mis_from_backend=True)[-40:], + cfg["SIGMA_PARAMS"]["r_proj"], + cfg["SIGMA_PARAMS"]["z_cl"], + r_mis=0.1, + verbose=True, + mis_from_backend=True, + )[-40:], (cfg["numcosmo_profiles"]["Sigma"] + cfg["numcosmo_profiles"]["DeltaSigma"])[-40:], 8.5e-3, ) assert_allclose( mod.eval_excess_surface_density( - cfg["SIGMA_PARAMS"]["r_proj"], cfg["SIGMA_PARAMS"]["z_cl"], r_mis=0.1, - verbose=True)[-40:], + cfg["SIGMA_PARAMS"]["r_proj"], + cfg["SIGMA_PARAMS"]["z_cl"], + r_mis=0.1, + verbose=True, + )[-40:], cfg["numcosmo_profiles"]["DeltaSigma"][-40:], - 2.5e-2 + 2.5e-2, ) assert_allclose( mod.eval_excess_surface_density( - cfg["SIGMA_PARAMS"]["r_proj"], cfg["SIGMA_PARAMS"]["z_cl"], r_mis=0.1, - verbose=True, mis_from_backend=False)[-40:], + cfg["SIGMA_PARAMS"]["r_proj"], + cfg["SIGMA_PARAMS"]["z_cl"], + r_mis=0.1, + verbose=True, + mis_from_backend=False, + )[-40:], cfg["numcosmo_profiles"]["DeltaSigma"][-40:], - 2.5e-2 + 2.5e-2, ) + assert_equal(theo.miscentering.integrand_surface_density_nfw(0, 0.3, 0, 0.3), 1.0 / 3.0) assert_equal( - theo.miscentering.integrand_surface_density_nfw(0, 0.3, 0, 0.3), - 1./3.) - assert_equal( - theo.miscentering.integrand_surface_density_hernquist(0, 0.3, 0, 0.3), - 4./15.) + theo.miscentering.integrand_surface_density_hernquist(0, 0.3, 0, 0.3), 4.0 / 15.0 + ) if mod.backend == "ct": assert_raises( ValueError, mod.eval_excess_surface_density, 1e-12, cfg["SIGMA_PARAMS"]["z_cl"] @@ -431,48 +450,57 @@ def test_profiles(modeling_data, profile_init): if mod.backend == "nc": assert_allclose( theo.compute_surface_density( - cosmo=cosmo, **cfg["SIGMA_PARAMS"], alpha_ein=alpha_ein, verbose=True, - r_mis=0.1 + cosmo=cosmo, **cfg["SIGMA_PARAMS"], alpha_ein=alpha_ein, verbose=True, r_mis=0.1 )[-40:], cfg["numcosmo_profiles"]["Sigma"][-40:], 2.5e-2, ) assert_allclose( theo.compute_surface_density( - cosmo=cosmo, **cfg["SIGMA_PARAMS"], alpha_ein=alpha_ein, verbose=True, - r_mis=0.1, mis_from_backend=True + cosmo=cosmo, + **cfg["SIGMA_PARAMS"], + alpha_ein=alpha_ein, + verbose=True, + r_mis=0.1, + mis_from_backend=True, )[-40:], cfg["numcosmo_profiles"]["Sigma"][-40:], 2.5e-2, ) assert_allclose( theo.compute_mean_surface_density( - cosmo=cosmo, **cfg["SIGMA_PARAMS"], alpha_ein=alpha_ein, verbose=True, - r_mis=0.1 + cosmo=cosmo, **cfg["SIGMA_PARAMS"], alpha_ein=alpha_ein, verbose=True, r_mis=0.1 )[-40:], (cfg["numcosmo_profiles"]["Sigma"] + cfg["numcosmo_profiles"]["DeltaSigma"])[-40:], 8.5e-3, ) assert_allclose( theo.compute_mean_surface_density( - cosmo=cosmo, **cfg["SIGMA_PARAMS"], alpha_ein=alpha_ein, verbose=True, - r_mis=0.1, mis_from_backend=True + cosmo=cosmo, + **cfg["SIGMA_PARAMS"], + alpha_ein=alpha_ein, + verbose=True, + r_mis=0.1, + mis_from_backend=True, )[-40:], (cfg["numcosmo_profiles"]["Sigma"] + cfg["numcosmo_profiles"]["DeltaSigma"])[-40:], 8.5e-3, ) assert_allclose( theo.compute_excess_surface_density( - cosmo=cosmo, **cfg["SIGMA_PARAMS"], alpha_ein=alpha_ein, verbose=True, - r_mis=0.1 + cosmo=cosmo, **cfg["SIGMA_PARAMS"], alpha_ein=alpha_ein, verbose=True, r_mis=0.1 )[-40:], cfg["numcosmo_profiles"]["DeltaSigma"][-40:], 2.5e-2, ) assert_allclose( theo.compute_excess_surface_density( - cosmo=cosmo, **cfg["SIGMA_PARAMS"], alpha_ein=alpha_ein, verbose=True, - r_mis=0.1, mis_from_backend=True + cosmo=cosmo, + **cfg["SIGMA_PARAMS"], + alpha_ein=alpha_ein, + verbose=True, + r_mis=0.1, + mis_from_backend=True, )[-40:], cfg["numcosmo_profiles"]["DeltaSigma"][-40:], 2.5e-2,