redshifts_from_comoving_density

skypy.galaxy.redshift.redshifts_from_comoving_density(redshift, density, fsky, 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 fraction fsky 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.

fskyarray_like

Sky fraction over which galaxies are sampled.

cosmologyCosmology, optional

Cosmology object for conversion to comoving volume. If not given, the default cosmology is used.

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.

Examples

Sample redshifts with a constant comoving number density 1e-3/Mpc3 up to redshift 1 for a survey of 1 square degree = 1/41253 of the sky.

>>> from skypy.galaxy.redshift import redshifts_from_comoving_density
>>> z_range = np.arange(0, 1.01, 0.1)
>>> z_gal = redshifts_from_comoving_density(z_range, 1e-3, 1/41253)