Skip to content

Commit

Permalink
fmt tests
Browse files Browse the repository at this point in the history
  • Loading branch information
m-aguena committed Oct 25, 2024
1 parent 25e7a0a commit ea9e0da
Showing 1 changed file with 59 additions and 31 deletions.
90 changes: 59 additions & 31 deletions tests/test_theory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit ea9e0da

Please sign in to comment.