lenspack.shear module¶
SHEAR MODULE
This module contains functions related to weak-lensing shear, for example measuring the tangential/cross components of shear about a point and computing the observed ellipticity of a galaxy that has been sheared by weak lensing.
- lenspack.shear.gamma_tx(ra, dec, gamma1, gamma2, center=(0, 0), coordinates='spherical')[source]¶
Compute the tangential/cross components of shear about a point.
- Parameters
ra (array_like, 1D) – Positions of points/galaxies on the sky. The metric used for calculating the polar angle between (ra, dec) and the reference point center is determined by the coordinates argument.
dec (array_like, 1D) – Positions of points/galaxies on the sky. The metric used for calculating the polar angle between (ra, dec) and the reference point center is determined by the coordinates argument.
gamma1 (array_like, 1D) – Two components of shear/ellipticity at the (ra, dec) locations.
gamma2 (array_like, 1D) – Two components of shear/ellipticity at the (ra, dec) locations.
center (tuple of floats, optional) – Reference position. Default is (0, 0).
coordinates ({'spherical', 'cartesian'}) – Whether to treat (ra, dec) positions as points on the sphere (‘spherical’) or the plane (‘cartesian’). Default is ‘spherical’.
- Returns
gamma_t, gamma_x – Tangential and cross shear/ellipticity component for each input.
- Return type
tuple of floats or 1D numpy arrays
Notes
The equations are from Schneider’s 2005 weak-lensing review [Eq. (17)].
gamma_t = -Re[gamma * exp(-2i * phi)], gamma_x = -Im[gamma * exp(-2i * phi)],
where gamma is the complex shear and phi is the polar angle relative to the reference point center.
- lenspack.shear.apply_shear(e1, e2, g1, g2)[source]¶
Shear galaxies with intrinsic ellipticity by a (reduced) shear.
- Parameters
e1 (array_like (1D)) – Intrinsic ellipticity components of galaxies.
e2 (array_like (1D)) – Intrinsic ellipticity components of galaxies.
g1 (array_like (1D)) – Weak-lensing reduced shear components to apply to e = e1 + ie2.
g2 (array_like (1D)) – Weak-lensing reduced shear components to apply to e = e1 + ie2.
- Returns
e1_obs, e2_obs – Two components of observed ellipticity.
- Return type
tuple of floats or (1D) numpy arrays
Warning
A warning will be printed if applying a non-weak shear, i.e. if abs(g) >= 1.
- lenspack.shear.random_rotation(gamma1, gamma2)[source]¶
Randomly rotate a spin-2 quantity, such as galaxy ellipticity.
- Parameters
gamma1 (array_like (1D)) – First and second components of the spin-2 quantity.
gamma2 (array_like (1D)) – First and second components of the spin-2 quantity.
- Returns
First and second components of the rotated quantity.
- Return type
tuple of floats or 1D numpy arrays