los_pvd_vs_rp¶
- halotools.mock_observables.los_pvd_vs_rp(sample1, velocities1, rp_bins, pi_max, sample2=None, velocities2=None, period=None, do_auto=True, do_cross=True, num_threads=1, approx_cell1_size=None, approx_cell2_size=None)[source]¶
Calculate the pairwise line-of-sight (LOS) velocity dispersion (PVD), as a function of radial distance from
sample1
\(\sigma_{z12}(r_p)\).Example calls to this function appear in the documentation below.
- Parameters:
- sample1array_like
Npts1 x 3 numpy array containing 3-D positions of points.
- velocities1array_like
Npts1 x 3 array containing the 3-D components of the velocities.
- rp_binsarray_like
array of boundaries defining the radial bins perpendicular to the LOS in which pairs are counted. Length units are comoving and assumed to be in Mpc/h, here and throughout Halotools.
- pi_maxfloat
maximum LOS separation Length units are comoving and assumed to be in Mpc/h, here and throughout Halotools.
- sample2array_like, optional
Npts2 x 3 array containing 3-D positions of points.
- velocities2array_like, optional
Npts2 x 3 array containing the 3-D components of the velocities.
- periodarray_like, optional
length 3 array defining periodic boundary conditions. If only one number, Lbox, is specified, period is assumed to be [Lbox, Lbox, Lbox].
- do_autoboolean, optional
calculate the auto-pairwise velocities?
- do_crossboolean, optional
calculate the cross-pairwise velocities?
- num_threadsint, optional
number of threads to use in calculation. Default is 1. A string ‘max’ may be used to indicate that the pair counters should use all available cores on the machine.
- Returns:
- sigmanumpy.array or tuple(numpy.arrays)
Each numpy.array is a len(rbins)-1 length array containing the dispersion of the pairwise velocity, \(\sigma_{12}(r)\), computed in each of the bins defined by
rbins
. If sample2 is None, returns \(\sigma_{11}(r)\) Ifdo_auto
anddo_cross
are True, returns (\(\sigma_{11}(r)\), \(\sigma_{12}(r)\), \(\sigma_{22}(r)\)) If onlydo_auto
is True, returns (\(\sigma_{11}(r)\), \(\sigma_{22}(r)\)) If onlydo_cross
is True, returns \(\sigma_{12}(r)\)
Notes
The pairwise LOS velocity, \(v_{z12}(r)\), is defined as:
\[v_{z12} = |\vec{v}_{\rm 1, pec}\cdot \hat{z}-\vec{v}_{\rm 2, pec}\cdot\hat{z}|\]where \(\vec{v}_{\rm 1, pec}\) is the peculiar velocity of object 1, and \(\hat{z}\) is the unit-z vector.
\(\sigma_{z12}(r_p)\) is the standard deviation of this quantity in projected radial bins.
Pairs and radial velocities are calculated using
velocity_marked_npairs_xy_z
.Examples
For demonstration purposes we create a randomly distributed set of points within a periodic unit cube.
>>> from halotools.mock_observables import los_pvd_vs_rp >>> Npts = 1000 >>> Lbox = 1.0 >>> period = np.array([Lbox,Lbox,Lbox])
>>> x = np.random.random(Npts) >>> y = np.random.random(Npts) >>> z = np.random.random(Npts)
We transform our x, y, z points into the array shape used by the pair-counter by taking the transpose of the result of
numpy.vstack
. This boilerplate transformation is used throughout themock_observables
sub-package:>>> coords = np.vstack((x,y,z)).T
We will do the same to get a random set of peculiar velocities.
>>> vx = np.random.random(Npts) >>> vy = np.random.random(Npts) >>> vz = np.random.random(Npts) >>> velocities = np.vstack((vx,vy,vz)).T
>>> rp_bins = np.logspace(-2,-1,10) >>> pi_max = 0.3 >>> sigmaz_12 = los_pvd_vs_rp(coords, velocities, rp_bins, pi_max, period=period)
>>> x2 = np.random.random(Npts) >>> y2 = np.random.random(Npts) >>> z2 = np.random.random(Npts) >>> coords2 = np.vstack((x2,y2,z2)).T
>>> vx2 = np.random.random(Npts) >>> vy2 = np.random.random(Npts) >>> vz2 = np.random.random(Npts) >>> velocities2 = np.vstack((vx2,vy2,vz2)).T
>>> sigmaz_12 = los_pvd_vs_rp(coords, velocities, rp_bins, pi_max, period=period, sample2=coords2, velocities2=velocities2)