Module: xrd.rotations¶
20 Functions¶
- hexrd.xrd.rotations.arccosSafe(temp)[source]¶
Protect against numbers slightly larger than 1 in magnitude due to round-off
- hexrd.xrd.rotations.misorientation(q1, q2, *args)[source]¶
sym is a tuple (crystal_symmetry, *sample_symmetry) generally coded, may split up special cases for no symmetry or crystal/sample only...
- hexrd.xrd.rotations.quatProduct(q1, q2)[source]¶
Product of two unit quaternions.
qp = quatProduct(q2, q1)
- q2, q1 are 4 x n, arrays whose columns are
- quaternion parameters
- qp is 4 x n, an array whose columns are the
- quaternion parameters of the product; the first component of qp is nonnegative
If R(q) is the rotation corresponding to the quaternion parameters q, then
R(qp) = R(q2) R(q1)
- hexrd.xrd.rotations.quatProductMatrix(quats, mult='right')[source]¶
Form 4 x 4 arrays to perform the quaternion product
- USAGE
- qmats = quatProductMatrix(quats, mult=’right’)
- INPUTS
quats is (4, n), a numpy ndarray array of n quaternions horizontally concatenated
mult is a keyword arg, either ‘left’ or ‘right’, denoting the sense of the multiplication:
/ quatProductMatrix(h, mult=’right’) * q
- q * h –> <
quatProductMatrix(q, mult=’left’) * h
- OUTPUTS
- qmats is (n, 4, 4), the left or right quaternion product operator
- NOTES
- *) This function is intended to replace a cross-product based
- routine for products of quaternions with large arrays of quaternions (e.g. applying symmetries to a large set of orientations).
- hexrd.xrd.rotations.quatOfAngleAxis(angle, rotaxis)[source]¶
make an hstacked array of quaternions from arrays of angle/axis pairs
- hexrd.xrd.rotations.rotMatOfExpMap_orig(expMap)[source]¶
Original rotMatOfExpMap, used for comparison to optimized version
- hexrd.xrd.rotations.rotMatOfQuat(quat)[source]¶
Take an array of n quats (numpy ndarray, 4 x n) and generate an array of rotation matrices (n x 3 x 3)
Uses the truncated series expansion for the exponential map; didvide-by-zero is checked using the global ‘tinyRotAng’
- discreteFiber(c, s, B=array([[ 1., 0., 0.],
- [ 0., 1., 0.],
- [ 0., 0., 1.]]), ndiv=120, invert=False, csym=None, ssym=None)
- hexrd.xrd.rotations.mapAngle(ang, *args, **kwargs)[source]¶
Utility routine to map an angle into a specified period
- hexrd.xrd.rotations.angularDifference_orig(angList0, angList1, units='radians')[source]¶
Do the proper (acute) angular difference in the context of a branch cut.
*) Default angular range in the code is [-pi, pi] *) ... maybe more efficient not to vectorize?