halotools.mock_observables.apply_zspace_distortion(true_pos, peculiar_velocity, redshift, cosmology, Lbox=None)[source] [edit on github]

Apply redshift-space distortions to the comoving simulation coordinate, optionally accounting for periodic boundary conditions.

This function implements the following formula:

\[s_{\rm com}^{\rm z-space} = s_{\rm com}^{\rm true} + \frac{1 + z}{H(z)}v_{\rm pec}\]

See Derivation of z−space Distortions in Simulation Data to see where this formula comes from.


true_pos : ndarray

Array of shape (npts, ) storing the line-of-sight position in comoving Mpc/h. In most cases true_pos is the z-coordinate of the simulation.

peculiar_velocity : ndarray

Array of shape (npts, ) storing the peculiar velocity in physical km/s. In most cases peculiar_velocity is the z-velocity of the simulation.

redshift : float or ndarray

Float or ndarray of shape (npts, ) storing the redshift of the object. If using a single snapshot, this argument is a single float equal to the redshift of the snapshot. If using a lightcone, this argument is the redshift of each point.

cosmology : object

Cosmology to assume when applying redshift-space distortions, e.g., the cosmology of the simulation.

Lbox : float, optional

Box length of the simulation so that periodic boundary conditions can be applied. Default behavior is None, in which case PBCs will be ignored.


zspace_pos : ndarray

Array of shape (npts, ) storing the z-space coordinates in comoving Mpc/h


>>> from halotools.sim_manager import FakeSim
>>> halocat = FakeSim()
>>> true_pos = halocat.halo_table['halo_z']
>>> peculiar_velocity = halocat.halo_table['halo_vz']
>>> redshift = halocat.redshift
>>> cosmology = halocat.cosmology
>>> Lbox = halocat.Lbox[2]
>>> zspace_zcoord = apply_zspace_distortion(true_pos, peculiar_velocity, redshift, cosmology, Lbox)