profiles.density.EinastoDensityProfile.compute_einstein_radius#
- EinastoDensityProfile.compute_einstein_radius(z_lens: float, z_source: float, units: str | Unit | None = 'arcsec', G: unyt_quantity | None = None, cosmology: Cosmology | None = None, **kwargs) unyt_array | unyt_quantity #
Compute the Einstein ring angular radius \(\\theta_E\) for a perfectly aligned source-lens system.
The Einstein radius satisfies:
\[\alpha( \theta_E D_l ) = \theta_E\]where:
\(\alpha\) is the angular deflection angle,
\(D_l\) is the angular diameter distance to the lens.
- Parameters:
z_lens (
float
) – Redshift of the lens.z_source (
float
) – Redshift of the source (must satisfy \(z_{\mathrm{source}} > z_{\mathrm{lens}}\)).units (
str
orUnit
, optional) – Desired output units for \(\\theta_E\). Default isarcsec
.G (
unyt_quantity
, optional) – Gravitational constant to use. Defaults tounyt.physical_constants.gravitational_constant
.cosmology (
astropy.cosmology.Cosmology
, optional) – Cosmology used to compute distances. Defaults topisces_config['physics.default_cosmology']
.**kwargs – Additional arguments passed to
compute_enclosed_mass()
.
- Returns:
theta_E – Einstein radius in specified angular units.
- Return type:
- Raises:
ValueError – If redshifts are invalid or distances cannot be computed.
Examples
from astropy.cosmology import Planck18 from pisces.profiles.density import ( HernquistDensityProfile, ) profile = HernquistDensityProfile( rho_0=0.02, r_s=5 ) theta_E = profile.compute_einstein_radius( z_lens=0.3, z_source=2.0, cosmology=Planck18 ) print(f"Einstein radius: {theta_E:.3f}")