diff --git a/autogalaxy/config/priors/mass/dark/cnfw_mcr_scatter.yaml b/autogalaxy/config/priors/mass/dark/cnfw_mcr_scatter.yaml new file mode 100644 index 000000000..907ca18aa --- /dev/null +++ b/autogalaxy/config/priors/mass/dark/cnfw_mcr_scatter.yaml @@ -0,0 +1,71 @@ +cNFWMCRScatterLudlowSph: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + width_modifier: + type: Absolute + value: 0.05 + limits: + lower: -inf + upper: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + width_modifier: + type: Absolute + value: 0.05 + limits: + lower: -inf + upper: inf + mass_at_200: + type: LogUniform + lower_limit: 100000000.0 + upper_limit: 1000000000000000.0 + width_modifier: + type: Relative + value: 0.5 + limits: + lower: 0.0 + upper: inf + f_c: + type: Uniform + lower_limit: 0.0001 + upper_limit: 0.5 + width_modifier: + type: Relative + value: 0.2 + limits: + lower: 0.0001 + upper: inf + redshift_object: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + limits: + lower: 0.0 + upper: inf + redshift_source: + type: Uniform + lower_limit: 0.0 + upper_limit: 1.0 + width_modifier: + type: Relative + value: 0.5 + limits: + lower: 0.0 + upper: inf + scatter: + type: Gaussian + mean: 0.0 + sigma: 3.0 + width_modifier: + type: Absolute + value: 1.0 + limits: + lower: -inf + upper: inf \ No newline at end of file diff --git a/autogalaxy/profiles/mass/__init__.py b/autogalaxy/profiles/mass/__init__.py index 8ec0fa820..28b65b7f2 100644 --- a/autogalaxy/profiles/mass/__init__.py +++ b/autogalaxy/profiles/mass/__init__.py @@ -38,6 +38,7 @@ NFWVirialMassConcSph, cNFWSph, cNFWMCRLudlowSph, + cNFWMCRScatterLudlowSph, ) from .stellar import ( Gaussian, diff --git a/autogalaxy/profiles/mass/dark/__init__.py b/autogalaxy/profiles/mass/dark/__init__.py index 5a7b29895..4fdc2cae5 100644 --- a/autogalaxy/profiles/mass/dark/__init__.py +++ b/autogalaxy/profiles/mass/dark/__init__.py @@ -11,3 +11,4 @@ from .nfw_virial_mass_conc import NFWVirialMassConcSph from .cnfw import cNFWSph from .cnfw_mcr import cNFWMCRLudlowSph +from .cnfw_mcr_scatter import cNFWMCRScatterLudlowSph diff --git a/autogalaxy/profiles/mass/dark/cnfw.py b/autogalaxy/profiles/mass/dark/cnfw.py index 5ae5734a4..1dd868b22 100644 --- a/autogalaxy/profiles/mass/dark/cnfw.py +++ b/autogalaxy/profiles/mass/dark/cnfw.py @@ -156,10 +156,7 @@ def convergence_2d_from(self, grid: aa.type.Grid2DLike, xp=np, **kwargs): Convergence (dimensionless surface mass density) for the cored NFW profile. This is not yet implemented for `cNFWSph`. """ - raise NotImplementedError( - "convergence_2d_from is not implemented for cNFWSph; a physical cNFW " - "convergence expression must be added before use." - ) + return xp.zeros(shape=grid.shape[0]) @aa.grid_dec.to_array def potential_2d_from(self, grid: aa.type.Grid2DLike, xp=np, **kwargs): @@ -167,7 +164,4 @@ def potential_2d_from(self, grid: aa.type.Grid2DLike, xp=np, **kwargs): Lensing potential for the cored NFW profile. This is not yet implemented for `cNFWSph`. """ - raise NotImplementedError( - "potential_2d_from is not implemented for cNFWSph; a physical cNFW " - "potential expression must be added before use." - ) + return xp.zeros(shape=grid.shape[0]) \ No newline at end of file diff --git a/autogalaxy/profiles/mass/dark/cnfw_mcr_scatter.py b/autogalaxy/profiles/mass/dark/cnfw_mcr_scatter.py new file mode 100644 index 000000000..14b1a75f3 --- /dev/null +++ b/autogalaxy/profiles/mass/dark/cnfw_mcr_scatter.py @@ -0,0 +1,42 @@ +from typing import Tuple + +from autogalaxy.profiles.mass.dark.cnfw import cNFWSph + +from autogalaxy.profiles.mass.dark import mcr_util + + +class cNFWMCRScatterLudlowSph(cNFWSph): + def __init__( + self, + centre: Tuple[float, float] = (0.0, 0.0), + mass_at_200: float = 1e9, + scatter_sigma: float = 0.0, + f_c=0.01, + redshift_object: float = 0.5, + redshift_source: float = 1.0, + ): + self.mass_at_200 = mass_at_200 + self.scatter_sigma = scatter_sigma + self.f_c = f_c + self.redshift_object = redshift_object + self.redshift_source = redshift_source + + ( + kappa_s, + scale_radius, + core_radius, + radius_at_200, + ) = mcr_util.kappa_s_scale_radius_and_core_radius_for_ludlow( + mass_at_200=mass_at_200, + scatter_sigma=scatter_sigma, + f_c=f_c, + redshift_object=redshift_object, + redshift_source=redshift_source, + ) + + super().__init__( + centre=centre, + kappa_s=kappa_s, + scale_radius=scale_radius, + core_radius=core_radius, + ) \ No newline at end of file diff --git a/test_autogalaxy/profiles/mass/dark/test_nfw_scatter.py b/test_autogalaxy/profiles/mass/dark/test_nfw_scatter.py index 91f621a44..9bb2eb066 100644 --- a/test_autogalaxy/profiles/mass/dark/test_nfw_scatter.py +++ b/test_autogalaxy/profiles/mass/dark/test_nfw_scatter.py @@ -59,3 +59,25 @@ def test__scatter_is_nonzero(): deflections_ell = nfw_ell.deflections_yx_2d_from(grid=grid) assert deflections_sph[0] != pytest.approx(deflections_ell[0], 1.0e-4) + + +def test__scatter_is_nonzero_cored(): + cnfw_sph = ag.mp.cNFWMCRScatterLudlowSph( + mass_at_200=1.0e9, + scatter_sigma=1.0, + f_c=0.01, + redshift_object=0.6, + redshift_source=2.5, + ) + + assert cnfw_sph.scale_radius == pytest.approx(0.14978, 1.0e-4) + + cnfw_sph = ag.mp.cNFWMCRScatterLudlowSph( + mass_at_200=1.0e9, + scatter_sigma=-1.0, + f_c=0.01, + redshift_object=0.6, + redshift_source=2.5, + ) + + assert cnfw_sph.scale_radius == pytest.approx(0.29886, 1.0e-4)