Observed shapes¶
The following functions provide functionality for simulating the observed shapes of objects, such as e.g. galaxies.
Ellipticity¶
- glass.ellipticity_gaussian(count, sigma, *, rng=None)[source]¶
Sample Gaussian galaxy ellipticities.
The ellipticities are sampled from a normal distribution with standard deviation
sigmafor each component. Samples where the ellipticity is larger than unity are discarded. Hence, do not use this function with too large values ofsigma, or the sampling will become inefficient.- Parameters:
- Returns:
An array of galaxy ellipticity.
- Return type:
- glass.ellipticity_intnorm(count, sigma, *, rng=None)[source]¶
Sample galaxy ellipticities with intrinsic normal distribution.
The ellipticities are sampled from an intrinsic normal distribution with standard deviation
sigmafor each component.- Parameters:
- Returns:
An array of galaxy ellipticity.
- Raises:
ValueError – If the standard deviation is not in the range [0, sqrt(0.5)].
- Return type:
- glass.ellipticity_ryden04(mu, sigma, gamma, sigma_gamma, size=None, *, rng=None)[source]¶
Ellipticity distribution following Ryden (2004).
The ellipticities are sampled by randomly projecting a 3D ellipsoid with principal axes \(A > B > C\) [Ryden04]. The distribution of \(\log(1 - B/A)\) is normal with mean \(\mu\) and standard deviation \(\sigma\). The distribution of \(1 - C/B\) is normal with mean \(\gamma\) and standard deviation \(\sigma_\gamma\) [Padilla08]. Both distributions are truncated to produce ratios in the range 0 to 1 using rejection sampling.
- Parameters:
mu (
float|ndarray[tuple[Any,...],dtype[float64]]) – Mean of the truncated normal for \(\log(1 - B/A)\).sigma (
float|ndarray[tuple[Any,...],dtype[float64]]) – Standard deviation for \(\log(1 - B/A)\).gamma (
float|ndarray[tuple[Any,...],dtype[float64]]) – Mean of the truncated normal for \(1 - C/B\).sigma_gamma (
float|ndarray[tuple[Any,...],dtype[float64]]) – Standard deviation for \(1 - C/B\).rng (
Generator|None) – Random number generator. If not given, a default RNG is used.
- Returns:
An array of ellipticity from projected axis ratios.
- Return type:
Utilities¶
- glass.triaxial_axis_ratio(zeta, xi, size=None, *, rng=None)[source]¶
Axis ratio of a randomly projected triaxial ellipsoid.
Given the two axis ratios 1 >= zeta >= xi of a randomly oriented triaxial ellipsoid, computes the axis ratio q of the projection.
- Parameters:
zeta (
float|ndarray[tuple[Any,...],dtype[float64]]) – Axis ratio of intermediate and major axis.xi (
float|ndarray[tuple[Any,...],dtype[float64]]) – Axis ratio of minor and major axis.size (
int|tuple[int,...] |None) – Size of the random draw.rng (
Generator|None) – Random number generator. If not given, a default RNG is used.
- Returns:
The axis ratio of the randomly projected ellipsoid.
- Return type:
Notes
See equations (11) and (12) in [Binney85] for details.