MCPcopy
hub / github.com/mne-tools/mne-python / _angle_between_quats

Function _angle_between_quats

mne/transforms.py:1412–1420  ·  view source on GitHub ↗

Compute the ang between two quaternions w/3-element representations.

(x, y=None)

Source from the content-addressed store, hash-verified

1410
1411
1412def _angle_between_quats(x, y=None):
1413 """Compute the ang between two quaternions w/3-element representations."""
1414 # z = conj(x) * y
1415 # conjugate just negates all but the first element in a 4-element quat,
1416 # so it's just a negative for us
1417 y = np.zeros(3) if y is None else y
1418 z = _quat_mult(-x, y)
1419 z0 = _quat_real(z)
1420 return 2 * np.arctan2(np.linalg.norm(z, axis=-1), z0)
1421
1422
1423def _quat_real(quat):

Callers 15

test_coregistrationFunction · 0.90
_assert_quatsFunction · 0.90
test_initial_fit_redoFunction · 0.90
test_quaternionsFunction · 0.90
test_vector_rotationFunction · 0.90
test_average_quatsFunction · 0.90
test_fit_matched_pointsFunction · 0.90
test_talxfm_rigidFunction · 0.90
_changesMethod · 0.85

Calls 3

_quat_multFunction · 0.85
_quat_realFunction · 0.85
normMethod · 0.80

Tested by 10

test_coregistrationFunction · 0.72
_assert_quatsFunction · 0.72
test_initial_fit_redoFunction · 0.72
test_quaternionsFunction · 0.72
test_vector_rotationFunction · 0.72
test_average_quatsFunction · 0.72
test_fit_matched_pointsFunction · 0.72
test_talxfm_rigidFunction · 0.72