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
sigma
for 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
sigma
for 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\) [1]. 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\) [2]. Both distributions are truncated to produce ratios in the range 0 to 1 using rejection sampling.
- Parameters:
mu (
float
|ndarray
[Any
,dtype
[float64
]]) – Mean of the truncated normal for \(\log(1 - B/A)\).sigma (
float
|ndarray
[Any
,dtype
[float64
]]) – Standard deviation for \(\log(1 - B/A)\).gamma (
float
|ndarray
[Any
,dtype
[float64
]]) – Mean of the truncated normal for \(1 - C/B\).sigma_gamma (
float
|ndarray
[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:
References
[1] Ryden B. S., 2004, ApJ, 601, 214.
[2] Padilla N. D., Strauss M. A., 2008, MNRAS, 388, 1321.
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
[Any
,dtype
[float64
]]) – Axis ratio of intermediate and major axis.xi (
float
|ndarray
[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 [1] for details.
References
[1] Binney J., 1985, MNRAS, 212, 767. doi:10.1093/mnras/212.4.767