profiles.density.CoredNFWDensityProfile.compute_deflection_angle#
- CoredNFWDensityProfile.compute_deflection_angle(R: unyt_array | unyt_quantity, mode: str = 'angular', units: str | Unit | None = 'arcsec', G: unyt_quantity | None = None, z_lens: float | None = None, z_source: float | None = None, D_l: unyt_array | unyt_quantity | None = None, D_s: unyt_array | unyt_quantity | None = None, D_ls: unyt_array | unyt_quantity | None = None, cosmology: Cosmology | None = None, **kwargs) unyt_array | unyt_quantity #
Compute the gravitational lensing deflection angle at projected radius \(R\).
Supports both physical and angular deflection:
Physical Deflection (length units):
\[\alpha_{\mathrm{phys}}(R) = \frac{4 G M(<R)}{c^2 R}\]Angular Deflection (default, angular units):
\[\alpha_{\mathrm{ang}}(R) = \alpha_{\mathrm{phys}}(R) \times \frac{D_{ls}}{D_s}\]
where:
\(M(<R)\) is the enclosed mass at projected radius \(R\)
\(D_l\), \(D_s\), \(D_{ls}\) are angular diameter distances to lens, source, and between lens and source, respectively.
- Parameters:
R (
unyt_quantity
orunyt_array
) – Projected radius in the lens plane with length units.mode (
{"physical", "angular"}
, optional) – Type of deflection to compute. Default isangular
.units (
str
orUnit
, optional) – Output units. For angular deflection, defaults toarcsec
.G (
unyt_quantity
, optional) – Gravitational constant to use. Defaults tounyt.physical_constants.gravitational_constant
.z_lens (
float
, optional) – Redshift of the lens (required for angular mode if distances not provided).z_source (
float
, optional) – Redshift of the source (required for angular mode if distances not provided).D_l (
unyt_quantity
, optional) – Angular diameter distance to the lens.D_s (
unyt_quantity
, optional) – Angular diameter distance to the source.D_ls (
unyt_quantity
, optional) – Angular diameter distance between lens and source.cosmology (
astropy.cosmology.Cosmology
, optional) – Cosmology used to compute distances if not provided. Defaults topisces_config['physics.default_cosmology']
.**kwargs – Additional arguments passed to
compute_enclosed_mass()
.
- Returns:
alpha – Deflection angle at each radius, in specified units.
- Return type:
- Raises:
ValueError – If necessary distances are missing or redshifts are inconsistent.
Examples
import unyt from astropy.cosmology import Planck18 from pisces.profiles.density import ( NFWDensityProfile, ) profile = NFWDensityProfile(rho_0=0.03, r_s=15) R = unyt.array.unyt_array([1, 5, 10], "kpc") alpha_arcsec = profile.compute_deflection_angle( R, mode="angular", units="arcsec", z_lens=0.3, z_source=2.0, cosmology=Planck18, ) print(alpha_arcsec)