Skip to content

Commit

Permalink
physical NFW
Browse files Browse the repository at this point in the history
  • Loading branch information
jhod0 committed Oct 17, 2023
1 parent b46e438 commit dcf9000
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 3 deletions.
33 changes: 33 additions & 0 deletions autogalaxy/config/priors/mass/dark/nfw_physical.yaml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions autogalaxy/profiles/mass/dark/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions autogalaxy/profiles/mass/dark/mcr_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand All @@ -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
Expand Down
45 changes: 45 additions & 0 deletions autogalaxy/profiles/mass/dark/nfw_physical.py
Original file line number Diff line number Diff line change
@@ -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,
)

0 comments on commit dcf9000

Please sign in to comment.