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, seed=None)[source] [edit on github]

Calculate the pairwise line-of-sight (LOS) velocity dispersion (PVD), \(\sigma_{z12}(r_p)\).

Example calls to this function appear in the documentation below.

Parameters:

sample1 : array_like

Npts x 3 numpy array containing 3-D positions of points.

velocities1 : array_like

N1pts x 3 array containing the 3-D components of the velocities.

rp_bins : array_like

array of boundaries defining the radial bins perpendicular to the LOS in which pairs are counted.

pi_max : float

maximum LOS separation

sample2 : array_like, optional

Npts x 3 array containing 3-D positions of points.

velocities2 : array_like, optional

N1pts x 3 array containing the 3-D components of the velocities.

period : array_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_auto : boolean, optional

caclulate the auto-pairwise velocities?

do_cross : boolean, optional

caclulate the cross-pairwise velocities?

num_threads : int, 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.

seed : int, optional

Random number seed used to randomly downsample data, if applicable. Default is None, in which case downsampling will be stochastic.

Returns:

sigma_12 : numpy.array

len(rbins)-1 length array containing the dispersion of the pairwise velocity, \(\sigma_{12}(r)\), computed in each of the bins defined by rbins.

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.

>>> 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 the mock_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)