redshifts_from_comoving_density

skypy.galaxies.redshift.redshifts_from_comoving_density(redshift, density, sky_area, cosmology, noise=True)[source] [edit on github]

Sample redshifts from a comoving density function.

Sample galaxy redshifts such that the resulting distribution matches a past lightcone with comoving galaxy number density density at redshifts redshift. The comoving volume sampled corresponds to a sky area sky_area and transverse comoving distance given by the cosmology cosmology.

If the noise parameter is set to true, the number of galaxies has Poisson noise. If noise is false, the expected number of galaxies is used.

Parameters:
redshiftarray_like

Redshifts at which comoving number densities are provided.

densityarray_like

Comoving galaxy number density at each redshift in Mpc-3.

sky_areaQuantity

Sky area over which galaxies are sampled. Must be in units of solid angle.

cosmologyCosmology

Cosmology object for conversion to comoving volume.

noisebool, optional

Poisson-sample the number of galaxies. Default is True.

Returns:
redshiftsarray_like

Sampled redshifts such that the comoving number density of galaxies corresponds to the input distribution.

Warning

The inverse cumulative distribution function is approximated from the number density and comoving volume calculated at the given redshift values. The user must choose suitable redshift values to satisfy their desired numerical accuracy.