lib.catalog.utils.vector_projection

lib.catalog.utils.vector_projection(vector, direction)

Vector components of given vectors in a given direction.

\[\begin{split}\mathbf{v}_\mathbf{d} &= (\mathbf{v} \cdot \hat{\mathbf{d}}) \hat{\mathbf{d}} \\ \hat{\mathbf{d}} &= \frac{\mathbf{d}}{\|\mathbf{d}\|}\end{split}\]

Adapted from https://github.com/bccp/nbodykit/blob/master/nbodykit/transform.py

Parameters
  • vector (array) – Array of vectors to be projected (along last dimension).

  • direction (array) – Projection direction, 1D or 2D (if different direction for each input vector) array. It will be normalized.

Returns

projection – Vector components of the given vectors in the given direction. Same shape as input vector.

Return type

array