33from typing import Tuple
44
55from autogalaxy .profiles .mass .dark .abstract import AbstractgNFW
6+ from autogalaxy .profiles .mass .abstract .mge import MGEDecomposer
67
78import autoarray as aa
89
910
10- class cNFWSph (AbstractgNFW ):
11+ class cNFW (AbstractgNFW ):
12+ def __init__ (
13+ self ,
14+ centre : Tuple [float , float ] = (0.0 , 0.0 ),
15+ ell_comps : Tuple [float , float ] = (0.0 , 0.0 ),
16+ kappa_s : float = 0.05 ,
17+ scale_radius : float = 1.0 ,
18+ core_radius : float = 0.01 ,
19+ ):
20+ """
21+ Represents a cored NFW density distribution
22+
23+ Parameters
24+ ----------
25+ centre
26+ The (y,x) arc-second coordinates of the profile centre.
27+ ell_comps
28+ The first and second ellipticity components of the elliptical coordinate system.
29+ kappa_s
30+ The overall normalization of the dark matter halo
31+ (kappa_s = (rho_0 * D_d * scale_radius)/lensing_critical_density)
32+ scale_radius
33+ The cored NFW scale radius `theta_s`, as an angle on the sky in arcseconds.
34+ core_radius
35+ The cored NFW core radius `theta_c`, as an angle on the sky in arcseconds.
36+ """
37+
38+ super ().__init__ (centre = centre , ell_comps = ell_comps )
39+
40+ self .kappa_s = kappa_s
41+ self .scale_radius = scale_radius
42+ self .core_radius = core_radius
43+
44+
45+ def deflections_yx_2d_from (self , grid : aa .type .Grid2DLike , xp = np , ** kwargs ):
46+ return self .deflections_2d_via_mge_from (grid = grid , xp = xp , ** kwargs )
47+
48+ def deflections_2d_via_mge_from (self , grid : aa .type .Grid2DLike , xp = np , ** kwargs ):
49+ radii_min = self .scale_radius / 1000.0
50+ radii_max = self .scale_radius * 200.0
51+ log_sigmas = xp .linspace (xp .log (radii_min ), xp .log (radii_max ), 20 )
52+ sigmas = xp .exp (log_sigmas )
53+
54+ mge_decomp = MGEDecomposer (mass_profile = self )
55+
56+ deflections_via_mge = mge_decomp .deflections_2d_via_mge_from (
57+ grid = grid ,
58+ xp = xp ,
59+ sigma_log_list = sigmas ,
60+ ellipticity_convention = 'major' ,
61+ three_D = True
62+ )
63+ return deflections_via_mge
64+
65+ def density_3d_func (self , r , xp = np ):
66+
67+ rho_at_scale_radius = (
68+ self .kappa_s / self .scale_radius
69+ ) # density parameter of 3D gNFW
70+
71+ return (
72+ rho_at_scale_radius
73+ * self .scale_radius ** 3.0
74+ * (r .array + self .core_radius ) ** (- 1.0 )
75+ * (r .array + self .scale_radius ) ** (- 2.0 )
76+ )
77+
78+
79+ class cNFWSph (cNFW ):
1180 def __init__ (
1281 self ,
1382 centre : Tuple [float , float ] = (0.0 , 0.0 ),
@@ -23,7 +92,7 @@ def __init__(
2392 centre
2493 The (y,x) arc-second coordinates of the profile centre.
2594 kappa_s
26- The overall normalization of the dark matter halo \|
95+ The overall normalization of the dark matter halo
2796 (kappa_s = (rho_0 * D_d * scale_radius)/lensing_critical_density)
2897 scale_radius
2998 The cored NFW scale radius `theta_s`, as an angle on the sky in arcseconds.
@@ -165,16 +234,3 @@ def potential_2d_from(self, grid: aa.type.Grid2DLike, xp=np, **kwargs):
165234 This is not yet implemented for `cNFWSph`.
166235 """
167236 return xp .zeros (shape = grid .shape [0 ])
168-
169- def density_3d_func (self , theta , xp = np ):
170-
171- rho_at_scale_radius = (
172- self .kappa_s / self .scale_radius
173- ) # density parameter of 3D gNFW
174-
175- return (
176- rho_at_scale_radius
177- * self .scale_radius ** 3.0
178- * (theta .array + self .core_radius ) ** (- 1.0 )
179- * (theta .array + self .scale_radius ) ** (- 2.0 )
180- )
0 commit comments