From dcf900078936fb6f08dfca391326b8e90d21ac0c Mon Sep 17 00:00:00 2001 From: Jack O'Donnell Date: Tue, 17 Oct 2023 12:55:58 -0700 Subject: [PATCH] physical NFW --- .../config/priors/mass/dark/nfw_physical.yaml | 33 ++++++++++++++ autogalaxy/profiles/mass/dark/__init__.py | 1 + autogalaxy/profiles/mass/dark/mcr_util.py | 6 +-- autogalaxy/profiles/mass/dark/nfw_physical.py | 45 +++++++++++++++++++ 4 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 autogalaxy/config/priors/mass/dark/nfw_physical.yaml create mode 100644 autogalaxy/profiles/mass/dark/nfw_physical.py diff --git a/autogalaxy/config/priors/mass/dark/nfw_physical.yaml b/autogalaxy/config/priors/mass/dark/nfw_physical.yaml new file mode 100644 index 00000000..8e69807a --- /dev/null +++ b/autogalaxy/config/priors/mass/dark/nfw_physical.yaml @@ -0,0 +1,33 @@ +NFWPhysical: + centre_0: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + centre_1: + type: Gaussian + mean: 0.0 + sigma: 0.1 + lower_limit: -inf + upper_limit: inf + ell_comps_0: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + ell_comps_1: + type: Gaussian + mean: 0.0 + sigma: 0.3 + lower_limit: -1.0 + upper_limit: 1.0 + log10M: + type: Uniform + lower_limit: 6 + upper_limit: 16 + concentration: + type: Uniform + lower_limit: 1 + upper_limit: 30 diff --git a/autogalaxy/profiles/mass/dark/__init__.py b/autogalaxy/profiles/mass/dark/__init__.py index 7a5e25bd..8b2f05ee 100644 --- a/autogalaxy/profiles/mass/dark/__init__.py +++ b/autogalaxy/profiles/mass/dark/__init__.py @@ -7,3 +7,4 @@ from .nfw_truncated_mcr import NFWTruncatedMCRLudlowSph, NFWTruncatedMCRDuffySph from .nfw_truncated_mcr_scatter import NFWTruncatedMCRScatterLudlowSph from .nfw_virial_mass_conc import NFWVirialMassConcSph +from .nfw_physical import NFWPhysical diff --git a/autogalaxy/profiles/mass/dark/mcr_util.py b/autogalaxy/profiles/mass/dark/mcr_util.py index 738f9fe7..db288514 100644 --- a/autogalaxy/profiles/mass/dark/mcr_util.py +++ b/autogalaxy/profiles/mass/dark/mcr_util.py @@ -66,7 +66,7 @@ def physical_nfw_to_autogalaxy( col_cosmo_obj = set_colossus_cosmo(cosmology, sigma8, ns) halo = profile_nfw.NFWProfile( - M=mass*col_cosmo_obj.h(), c=concentration, z=redshift_object, mdef=mdef + M=mass*col_cosmo_obj.h, c=concentration, z=redshift_object, mdef=mdef ) critical_surface_density = ( @@ -77,8 +77,8 @@ def physical_nfw_to_autogalaxy( kpc_per_arcsec = cosmology.kpc_per_arcsec_from(redshift=redshift_object) # rho_s in Msun kpc-3, and rs in kpc - rho_s = halo.par['rhos']*col_cosmo_obj.h()**2 - rs = halo.par['rs']/col_cosmo_obj.h() + rho_s = halo.par['rhos']*col_cosmo_obj.h**2 + rs = halo.par['rs']/col_cosmo_obj.h r200 = rs * concentration kappa_s = rho_s * rs / critical_surface_density diff --git a/autogalaxy/profiles/mass/dark/nfw_physical.py b/autogalaxy/profiles/mass/dark/nfw_physical.py new file mode 100644 index 00000000..ff814df5 --- /dev/null +++ b/autogalaxy/profiles/mass/dark/nfw_physical.py @@ -0,0 +1,45 @@ +from .nfw import NFW +from .mcr_util import physical_nfw_to_autogalaxy +from autogalaxy.cosmology.lensing import LensingCosmology +from autogalaxy.cosmology.wrap import Planck15 +from typing import Tuple + + +class NFWPhysical(NFW): + ''' + An NFW halo, sampled by it's physical parameters (mass, concentration). + + This class can interpret any mass definition known by `colossus`, specifed by the + `mdef` argument. By default, this is `200c`, but one could use `200m`, `500c`, `vir`, + etc. + + The `centre` and `ell_comps` are interpreted exactly the same as in the `NFW` halo defined + in lensing units. i.e., `centre` is in arcsec. + ''' + def __init__( + self, + centre: Tuple[float, float] = (0.0, 0.0), + ell_comps: Tuple[float, float] = (0.0, 0.0), + log10M: float = 12, + concentration: float = 10, + mdef: str = '200c', + redshift_object: float = 0.5, + redshift_source: float = 1.0, + cosmo: LensingCosmology = Planck15(), + ): + self.params = { + 'log10M': log10M, + 'concentration': concentration, + 'mdef': mdef, + 'redshift_object': redshift_object, + 'redshift_source': redshift_source + } + kappa_s, scale_radius, radius_at_100 = physical_nfw_to_autogalaxy( + 10**log10M, concentration, + mdef=mdef, redshift_object=redshift_object, redshift_source=redshift_source, + cosmology=cosmo + ) + super().__init__( + centre, ell_comps, + kappa_s, scale_radius, + )