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.


Redshifts at which comoving number densities are provided.


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


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


Cosmology object for conversion to comoving volume.

noisebool, optional

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


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


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.