autogalaxy.profiles.mass.dPIEMassB0#

class dPIEMassB0[source]#

Bases: MassProfile

The dual Pseudo Isothermal Elliptical Mass Distribution(dPIEMass) profiles, which is a two component PIEMass with both a core radius and a truncation radius, see Eliasdottir (2007): https://arxiv.org/abs/0710.5636 This profile is ported from Lenstool’s C code, which has the same formulation.

This proflie describes an elliptic isothermal mass distribution with a finite core, rho r^{-2} while in the transition region (ra<=R<=rs), and rho r^{-4} in the outer parts: rho propto [(ra^2 + R^2) (rs^2 + R^2)]^{-1}

The convergence is given by two PIEMass with core radius ra and rs: kappa(r_{em}) = rs / (rs - ra) * (kappa_{PIEMass,ra} - kappa_{PIEMass,rs})

= b_0 / 2 * rs / (rs - ra) * ( frac{1}{sqrt{ ra^2 + r_{em}^2}} - frac{1}{sqrt{ rs^2 + r_{em}^2}} )

where r_{em}^2 = x^2 / (1 + epsilon)^2 + y^2 / (1 - epsilon)^2. Note in Eliasdottir (2007), E0 = 6pi * sigma_{dPIEPotential}^2 / c^2 * (D_{LS} / D_{S}). Eliasdottir’s E0 is not the same as E0 in Kassiola & Kovner(1993) which is also b0. There is frac{sigma_{dPIEPotential}^2}{sigma_0^2} = frac{2}{3}

rac{rs^2}{rs^2-ra^2},

thus E0(Kassiola & Kovner(1993)) = b0 = E0(Eliasdottir (2007)) * (rs^2 - ra^2) / rs^2. So when s->infty and a->0, they are equivalent.

In this implementation: - ra is the core radius in unit of arcseconds. - rs is the truncation radius in unit of arcseconds. - b0 is the lens strength in unit of arcseconds, when ra->0 & rs->infty & q->1, b0 is the Einstein radius.

b0 is related to the central velocity dispersion sigma_0: b_0 = 4pi * sigma_0^2 / c^2 * (D_{LS} / D_{S}) b0 is not in the Intermediate-Axis-Convention for its r_{em}^2 = x^2 / (1 + epsilon)^2 + y^2 / (1 - epsilon)^2

Parameters:
  • centre (Tuple[float, float]) – The (y,x) arc-second coordinates of the profile centre.

  • ra (float) – The inner core radius in arcseconds.

  • rs (float) – The outer truncation radius in arcseconds.

  • b0 (float) – The lens strength in arcseconds.

Methods

analytical_hessian_2d_from

Calculate the hessian matrix on a grid of (y,x) arc-second coordinates.

analytical_magnification_2d_from

angle

The position angle in degrees of the major-axis of the ellipse defined by profile, defined counter clockwise from the positive x-axis (0.0 > angle > 180.0).

angle_radians

The position angle in radians of the major-axis of the ellipse defined by profile, defined counter clockwise from the positive x-axis (0.0 > angle > 2pi).

angle_to_profile_grid_from

The angle between each angle theta on the grid and the profile, in radians.

axis_ratio

The ratio of the minor-axis to major-axis (b/a) of the ellipse defined by profile (0.0 > q > 1.0).

convergence_2d_from

Returns the two dimensional projected convergence on a grid of (y,x) arc-second coordinates.

convergence_func

Returns the convergence of the mass profile as a function of the radial coordinate.

deflections_2d_via_potential_2d_from

Returns the 2D deflection angles of the mass profile by numerically differentiating the lensing potential on the input grid.

deflections_yx_2d_from

Calculate the deflection angles on a grid of (y,x) arc-second coordinates.

density_between_circular_annuli

Calculate the mass between two circular annuli and compute the density by dividing by the annuli surface area.

eccentric_radii_grid_from

Convert a grid of (y,x) coordinates to an eccentric radius: :math: axis_ratio^0.5 (x^2 + (y^2/q))^0.5

elliptical_radii_grid_from

Convert a grid of (y,x) coordinates to their elliptical radii values: :math: (x^2 + (y^2/q))^0.5

extract_attribute

Returns an attribute of a class and its children profiles in the galaxy as a ValueIrregular or Grid2DIrregular object.

from_lenstool

Construct a dPIEMassB0 from Lenstool's native dPIE / PIEMD parameterization, as read directly out of a Lenstool .par file (potentiel profil 81) or the parameter tables of Lenstool-based papers.

has

Returns True if any attribute of this profile is an instance of the input class cls, else False.

mass_angular_within_circle_from

Integrate the mass profiles's convergence profile to compute the total mass within a circle of specified radius.

mass_integral

Integrand used by mass_angular_within_circle_from to compute the total projected mass within a circle.

potential_2d_from

Returns the two dimensional projected lensing potential on a grid of (y,x) arc-second coordinates.

potential_func

Returns the integrand of the lensing potential at a single point, used in numerical integration schemes for computing the potential from the mass profile's convergence.

radial_deflection_from

radial_grid_from

Convert a grid of (y, x) coordinates, to their radial distances from the profile centre (e.g. :math: r = sqrt(x**2 + y**2)).

rotated_grid_from_reference_frame_from

Rotate a grid of (y,x) coordinates which have been transformed to the elliptical reference frame of a profile back to the original unrotated coordinate grid reference frame.

transformed_from_reference_frame_grid_from

Transform a grid of (y,x) coordinates from the reference frame of the profile to the original observer reference frame.

transformed_to_reference_frame_grid_from

Transform a grid of (y,x) coordinates to the reference frame of the profile.

vmapped_deflections_from

Attributes

average_convergence_of_1_radius

The radius a critical curve forms for this mass profile, e.g. where the mean convergence is equal to 1.0.

ellipticity_rescale

A rescaling factor applied to account for the ellipticity of the mass profile when computing the Einstein radius from the average convergence equals unity criterion.

classmethod from_lenstool(centre=(0.0, 0.0), ellipticity=0.0, angle_pos=0.0, sigma=200.0, r_core=0.1, r_cut=20.0, redshift_object=0.5, redshift_source=1.0, cosmology=None)[source]#

Construct a dPIEMassB0 from Lenstool’s native dPIE / PIEMD parameterization, as read directly out of a Lenstool .par file (potentiel profil 81) or the parameter tables of Lenstool-based papers.

For model-fitting in the Lenstool parameters use dPIEMass, whose constructor takes the same inputs (with a flat H0/Om0 cosmology so priors can be composed); this classmethod is the general converter accepting an arbitrary cosmology object (e.g. Planck15) and returning the internal parameterization.

Three Lenstool conventions are converted (each verified against the Lenstool C source):

  • sigma is Lenstool’s fiducial velocity dispersion v_disp (sigma_LT), not the central velocity dispersion sigma_0 of the dPIE profile. They differ by sigma_0 = sqrt(3/2) * sigma_LT (Eliasdottir et al. 2007, App. A; Bergamini et al. 2019, Eq. 5) — quoting a measured central/aperture dispersion here overestimates the mass by 50%. The lens strength is b0 = 6 * 648000 * (sigma_LT / c)^2 * (D_LS / D_S) arcsec, where Lenstool’s stored b0 = 6 * pia_c2 * sigma^2 (set_potfile.c) carries no distance ratio — Lenstool applies D_LS / D_S separately at deflection time (e_grad.c), whereas PyAutoGalaxy’s b0 is fully normalized.

  • ellipticity is Lenstool’s ellipticite for mass-type profiles, emass = (a^2 - b^2) / (a^2 + b^2). Lenstool converts it internally (set_lens.c) to epot = (1 - q) / (1 + q) before evaluating deflections; that epot is exactly the magnitude of PyAutoGalaxy’s ell_comps, so the conversion here is emass -> q = sqrt((1 - e) / (1 + e)) -> ell_comps.

  • r_core / r_cut (Lenstool core_radius / cut_radius, arcsec) map one-to-one onto ra / rs. For .par files using the kpc variants (core_radius_kpc / cut_radius_kpc), pre-convert with r_core = r_core_kpc / cosmology.kpc_per_arcsec_from(redshift=redshift_object).

Parameters:
  • centre (Tuple[float, float]) – The (y,x) arc-second coordinates of the profile centre.

  • ellipticity (float) – Lenstool mass ellipticity, (a^2 - b^2) / (a^2 + b^2).

  • angle_pos (float) – Position angle in degrees, counter-clockwise from the positive x-axis (Lenstool angle_pos in its tangent plane; axis flips from WCS conventions must be handled when ingesting real-data catalogues).

  • sigma (float) – Lenstool fiducial velocity dispersion v_disp (sigma_LT) in km/s.

  • r_core (float) – Lenstool core_radius in arcseconds (becomes ra).

  • r_cut (float) – Lenstool cut_radius in arcseconds (becomes rs).

  • redshift_object (float) – The redshift of the lens, used for the D_LS / D_S normalization of b0.

  • redshift_source (float) – The redshift of the source used to normalize b0. For multi-plane cluster models this is the reference source plane the Lenstool model was normalized to.

  • cosmology (LensingCosmology) – The cosmology used to compute the distance ratio (default Planck15; pass the cosmology of the Lenstool run for exact comparisons).

deflections_yx_2d_from(grid, xp=<module 'numpy' from '/home/docs/checkouts/readthedocs.org/user_builds/pyautolens/envs/latest/lib/python3.12/site-packages/numpy/__init__.py'>, **kwargs)[source]#

Calculate the deflection angles on a grid of (y,x) arc-second coordinates.

Parameters:

grid (Union[ndarray, Grid2D, Grid2DIrregular]) – The grid of (y,x) arc-second coordinates the deflection angles are computed on.

convergence_func(grid_radius, xp=<module 'numpy' from '/home/docs/checkouts/readthedocs.org/user_builds/pyautolens/envs/latest/lib/python3.12/site-packages/numpy/__init__.py'>)[source]#

Returns the convergence of the mass profile as a function of the radial coordinate.

This is used to integrate the convergence profile to compute enclosed masses and the Einstein radius.

Parameters:

grid_radius – The radial distance from the profile centre at which the convergence is evaluated.

Returns:

The convergence at the input radial distance.

Return type:

float

convergence_2d_from(grid, xp=<module 'numpy' from '/home/docs/checkouts/readthedocs.org/user_builds/pyautolens/envs/latest/lib/python3.12/site-packages/numpy/__init__.py'>, **kwargs)[source]#

Returns the two dimensional projected convergence on a grid of (y,x) arc-second coordinates.

The grid_2d_to_structure decorator reshapes the ndarrays the convergence is outputted on. See aa.grid_2d_to_structure for a description of the output.

Parameters:

grid (Union[ndarray, Grid2D, Grid2DIrregular]) – The grid of (y,x) arc-second coordinates the convergence is computed on.

analytical_hessian_2d_from(grid, xp=<module 'numpy' from '/home/docs/checkouts/readthedocs.org/user_builds/pyautolens/envs/latest/lib/python3.12/site-packages/numpy/__init__.py'>, **kwargs)[source]#

Calculate the hessian matrix on a grid of (y,x) arc-second coordinates. Hessian_dPIEMass = rs * (rs - ra) * ( Hessian_PIEMass(ra) - Hessian_PIEMass(rs))

Parameters:

grid (Union[ndarray, Grid2D, Grid2DIrregular]) – The grid of (y,x) arc-second coordinates the deflection angles are computed on.

analytical_magnification_2d_from(grid, xp=<module 'numpy' from '/home/docs/checkouts/readthedocs.org/user_builds/pyautolens/envs/latest/lib/python3.12/site-packages/numpy/__init__.py'>, **kwargs)[source]#
potential_2d_from(grid, xp=<module 'numpy' from '/home/docs/checkouts/readthedocs.org/user_builds/pyautolens/envs/latest/lib/python3.12/site-packages/numpy/__init__.py'>, **kwargs)[source]#

Returns the two dimensional projected lensing potential on a grid of (y,x) arc-second coordinates.

The analytic Kassiola & Kovner (1993) I0.5 potential of the dPIE is the same two-component difference as the deflections, ported from Lenstool’s C code (e_pot.c case 81, pi05 in e_pcpx.c):

psi = b0 * rs / (rs - ra) * (pi05(ra) - pi05(rs))

Parameters:

grid (Union[ndarray, Grid2D, Grid2DIrregular]) – The grid of (y,x) arc-second coordinates the potential is computed on.