Skip to content
Merged
Show file tree
Hide file tree
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
71 changes: 71 additions & 0 deletions autogalaxy/config/priors/mass/dark/cnfw_mcr_scatter.yaml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions autogalaxy/profiles/mass/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
NFWVirialMassConcSph,
cNFWSph,
cNFWMCRLudlowSph,
cNFWMCRScatterLudlowSph,
)
from .stellar import (
Gaussian,
Expand Down
1 change: 1 addition & 0 deletions autogalaxy/profiles/mass/dark/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 2 additions & 8 deletions autogalaxy/profiles/mass/dark/cnfw.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,18 +156,12 @@ 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):
"""
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])
42 changes: 42 additions & 0 deletions autogalaxy/profiles/mass/dark/cnfw_mcr_scatter.py
Original file line number Diff line number Diff line change
@@ -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,
)
22 changes: 22 additions & 0 deletions test_autogalaxy/profiles/mass/dark/test_nfw_scatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Loading