spacepy.coordinates.quaternionMultiply

spacepy.coordinates.quaternionMultiply(Qin1, Qin2, scalarPos='last')[source]

Given quaternions, return the product, i.e. Qin1*Qin2

Parameters
Qin1array_like

input quaternion, first position

Qin2array-like

input quaternion, second position

Returns
outarray_like

quaternion product

Examples

>>> import spacepy.coordinates
>>> import numpy as np
>>> vecX = [1, 0, 0] #shared X-axis
>>> vecZ = [0, 0, 1] #unshared, but similar, Z-axis
>>> quat_eci_to_gsm = [-0.05395384,  0.07589845, -0.15172533,  0.98402634]
>>> quat_eci_to_gse = [ 0.20016056,  0.03445775, -0.16611386,  0.96496352]
>>> quat_gsm_to_eci = spacepy.coordinates.quaternionConjugate(
...     quat_eci_to_gsm)
>>> quat_gse_to_gsm = spacepy.coordinates.quaternionMultiply(
...     quat_gsm_to_eci, quat_eci_to_gse)
>>> spacepy.coordinates.quaternionRotateVector(quat_gse_to_gsm, vecX)
array([  1.00000000e+00,   1.06536725e-09,  -1.16892107e-08])
>>> spacepy.coordinates.quaternionRotateVector(quat_gse_to_gsm, vecZ)
array([  1.06802834e-08,  -4.95669027e-01,   8.68511494e-01])