qspec logo qspec logo

A physics toolbox for laser spectroscopy.

Static Badge Static Badge Static Badge

Static Badge Static Badge

© 2026 Patrick Müller. All rights reserved.

qspec. angle  (  x ,  y ,  axis=-1  )[source]

The angle between two vectors

$$ \alpha = \arccos\left(\frac{\vec{x}\cdot\vec{y}}{|\vec{x}||\vec{y}|}\right). $$
Parameters:
xarray_like

The first vectors $\vec{x}$ (arb. units).

yarray_like

The second vectors $\vec{y}$ (arb. units).

axisint

The axis along which the vector components are aligned.

Returns:
alphandarray

The angle $\alpha$ between the vectors x and y (rad).

Raises:
ValueError

If the shapes of x and y are not compatible.