Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions test_autogalaxy/profiles/mass/dark/test_kaplinghat.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
import importlib.util

import numpy as np
import pytest

import autogalaxy as ag

# The `vmapped_deflections_from` path is jax-backed; these tests need jax
# installed to run (it ships via the `[optional]` extras). The NumPy-only
# Python-version matrix has no jax, so skip there rather than fail.
requires_jax = pytest.mark.skipif(
importlib.util.find_spec("jax") is None,
reason="requires jax (installed via the [optional] extras; absent on the NumPy-only matrix env)",
)


def test__zero_interaction_limit_matches_nfw():
kaplinghat = ag.mp.KaplinghatCoredNFWSph(
Expand Down Expand Up @@ -59,6 +69,7 @@ def test__lensing_quantities_are_finite_and_positive():
assert deflections[0] == pytest.approx(np.array([0.0, 0.0]), abs=1.0e-8)


@requires_jax
def test__vmapped_deflections_match_instance_path_for_zero_interaction():
profile = ag.mp.KaplinghatCoredNFWSph(
centre=(0.1, -0.2),
Expand Down Expand Up @@ -97,6 +108,7 @@ def test__vmapped_deflections_match_instance_path_for_zero_interaction():
)


@requires_jax
def test__vmapped_deflections_match_instance_path_for_sidm_core():
profile = ag.mp.KaplinghatCoredNFWSph(
centre=(0.1, -0.2),
Expand Down
Loading