Galaxies (glass.galaxies)#

The glass.galaxies module provides functionality for simulating galaxies as typically observed in a cosmological galaxy survey.

Functions#

glass.galaxies.redshifts_from_nz(count, z, nz, *, rng=None)#

Generate galaxy redshifts from a source distribution.

The function supports sampling from multiple populations of redshifts if count is an array or if there are additional axes in the z or nz arrays. In this case, the shape of count and the leading dimensions of z and nz are broadcast to a common shape, and redshifts are sampled independently for each extra dimension. The results are concatenated into a flat array.

Parameters:
countint or array_like

Number of redshifts to sample. If an array is given, its shape is broadcast against the leading axes of z and nz.

z, nzarray_like

Source distribution. Leading axes are broadcast against the shape of count.

rngGenerator, optional

Random number generator. If not given, a default RNG is used.

Returns:
redshiftsarray_like

Redshifts sampled from the given source distribution. For inputs with extra dimensions, returns a flattened 1-D array of samples from all populations.

glass.galaxies.galaxy_shear(lon, lat, eps, kappa, gamma1, gamma2, *, reduced_shear=True)#

Observed galaxy shears from weak lensing.

Takes lensing maps for convergence and shear and produces a lensed ellipticity (shear) for each intrinsic galaxy ellipticity.

Parameters:
lon, latarray_like

Arrays for galaxy longitudes and latitudes.

epsarray_like

Array of galaxy ellipticity.

kappa, gamma1, gamma2array_like

HEALPix maps for convergence and two components of shear.

reduced_shearbool, optional

If False, galaxy shears are not reduced by the convergence. Default is True.

Returns:
shearray_like

Array of complex-valued observed galaxy shears (lensed ellipticities).

glass.galaxies.gaussian_phz(z, sigma_0, rng=None)#

Photometric redshifts assuming a Gaussian error.

A simple toy model of photometric redshift errors that assumes a Gaussian error with redshift-dependent standard deviation \(\sigma(z) = (1 + z) \sigma_0\) [1].

Parameters:
zarray_like

True redshifts.

sigma_0float or array_like

Redshift error in the tomographic binning at zero redshift.

rngGenerator, optional

Random number generator. If not given, a default RNG is used.

Returns:
phzarray_like

Photometric redshifts assuming Gaussian errors, of the same shape as z.

See also

glass.observations.tomo_nz_gausserr

Create tomographic redshift distributions assuming the same model.

References

[1]

Amara A., Réfrégier A., 2007, MNRAS, 381, 1018. doi:10.1111/j.1365-2966.2007.12271.x

Examples

See the Photometric redshifts example.