Skip to content

Commit 728bcb8

Browse files
author
Niek Wielders
committed
added test_nfw.py
1 parent 700f4fc commit 728bcb8

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import numpy as np
2+
import pytest
3+
4+
import autogalaxy as ag
5+
6+
def test__deflections_yx_2d_from():
7+
cnfw = ag.mp.cNFW(centre=(0.0, 0.0), kappa_s=0.01591814312464436, scale_radius=0.36, core_radius=0.036)
8+
9+
deflection_2d = cnfw.deflections_yx_2d_from(grid=ag.Grid2DIrregular([[1.0, 0.0]]))
10+
deflection_r = np.sqrt(deflection_2d[0]**2 + deflection_2d[1]**2)
11+
12+
assert deflection_r == pytest.approx(0.006034319441107217, 1.0e-8)
13+
14+
def test_convergence_2d_from():
15+
cnfw = ag.mp.cNFW(centre=(0.0, 0.0), kappa_s=0.01591814312464436, scale_radius=0.36, core_radius=0.036)
16+
17+
convergence_2d = cnfw.convergence_2d_from(grid=ag.Grid2DIrregular([[1.0, 0.0]]))
18+
convergence_r = np.sqrt(convergence_2d[0]**2 + convergence_2d[1]**2)
19+
20+
assert convergence_r == pytest.approx(0.0, 1.0e-4)
21+
22+
def potential_2d_from():
23+
cnfw = ag.mp.cNFW(centre=(0.0, 0.0), kappa_s=0.01591814312464436, scale_radius=0.36, core_radius=0.036)
24+
25+
potential_2d = cnfw.potential_2d_from(grid=ag.Grid2DIrregular([[1.0, 0.0]]))
26+
potential_r = np.sqrt(potential_2d[0] ** 2 + potential_2d[1] ** 2)
27+
28+
assert potential_r == pytest.approx(0.0, 1.0e-4)

0 commit comments

Comments
 (0)