ang2vec#
- torchspin.ang2vec(phi, theta)[source]#
Convert polar angles to a unit Cartesian 3-vector.
- Parameters:
- Returns:
v (ndarray, shape (3,) or (3, N)) – Unit Cartesian vector(s):
[sin(theta)*cos(phi), sin(theta)*sin(phi), cos(theta)].- Return type:
Notes
Inverse of
vec2ang. Matches EasySpin’sang2vec.m.Examples
>>> ang2vec(0, 0) # +z axis array([0., 0., 1.]) >>> ang2vec(0, np.pi/2) # +x axis array([1., 0., 0.])