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 of sigma, or the sampling will become inefficient.

Parameters:
  • count (int | ndarray[Any, dtype[int64]]) – Number of ellipticities to be sampled.

  • sigma (float | ndarray[Any, dtype[float64]]) – Standard deviation in each component.

  • rng (Generator | None) – Random number generator. If not given, a default RNG is used.

Returns:

An array of galaxy ellipticity.

Return type:

ndarray[Any, dtype[complex128]]

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:
  • count (int | ndarray[Any, dtype[int64]]) – Number of ellipticities to sample.

  • sigma (float | ndarray[Any, dtype[float64]]) – Standard deviation of the ellipticity in each component.

  • rng (Generator | None) – Random number generator. If not given, a default RNG is used.

Returns:

An array of galaxy ellipticity.

Raises:

ValueError – If the standard deviation is not in the range [0, sqrt(0.5)].

Return type:

ndarray[Any, dtype[complex128]]

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:
Returns:

An array of ellipticity from projected axis ratios.

Return type:

ndarray[Any, dtype[float64]]

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:
Returns:

The axis ratio of the randomly projected ellipsoid.

Return type:

ndarray[Any, dtype[float64]]

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