apply_zspace_distortion¶
- halotools.mock_observables.apply_zspace_distortion(true_pos, peculiar_velocity, redshift, cosmology, Lbox=None)[source]¶
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.
- Parameters:
- true_posndarray
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_velocityndarray
Array of shape (npts, ) storing the peculiar velocity in physical km/s. In most cases
peculiar_velocity
is the z-velocity of the simulation.- redshiftfloat 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.
- cosmologyastropy.cosmology.Cosmology
Cosmology to assume when applying redshift-space distortions, e.g., the cosmology of the simulation.
- Lboxfloat, 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.
- Returns:
- zspace_posndarray
Array of shape (npts, ) storing the z-space coordinates in comoving Mpc/h
Examples
>>> 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)