vectors_between_list_of_vectors

halotools.utils.vectors_between_list_of_vectors(x, y, p)[source] [edit on github]

Starting from two input lists of vectors, return a list of unit-vectors that lie in the same plane as the corresponding input vectors, and where the input p controls the angle between the returned vs. input vectors.

Parameters:

x : ndarray

Numpy array of shape (npts, 3) storing a collection of 3d vectors

Note that the normalization of x will be ignored.

y : ndarray

Numpy array of shape (npts, 3) storing a collection of 3d vectors

Note that the normalization of y will be ignored.

p : ndarray

Numpy array of shape (npts, ) storing values in the closed interval [0, 1]. For values of p equal to zero, the returned vectors will be exactly aligned with the input x; when p equals unity, the returned vectors will be aligned with y.

Returns:

v : ndarray

Numpy array of shape (npts, 3) storing a collection of 3d unit-vectors lying in the plane spanned by x and y. The angle between v and x will be equal to \(p*\theta_{\rm xy}\).

Examples

>>> npts = int(1e4)
>>> x = np.random.random((npts, 3))
>>> y = np.random.random((npts, 3))
>>> p = np.random.uniform(0, 1, npts)
>>> v = vectors_between_list_of_vectors(x, y, p)
>>> angles_xy = angles_between_list_of_vectors(x, y)
>>> angles_xp = angles_between_list_of_vectors(x, v)
>>> assert np.allclose(angles_xy*p, angles_xp)