hexrd.transforms.old_xfcapi module
- hexrd.transforms.old_xfcapi.anglesToDVec(angs, bHat_l=array([[-0.], [-0.], [-1.]]), eHat_l=array([[1.], [0.], [0.]]), chi=0.0, rMat_c=array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]))[source]
from ‘eta’ frame out to lab (with handy kwargs to go to crystal or sample)
setting omega to zero in ang imput and omitting rMat_c leaves in the lab frame in accordance with beam frame specs.
- hexrd.transforms.old_xfcapi.anglesToGVec(angs, bHat_l=array([[-0.], [-0.], [-1.]]), eHat_l=array([[1.], [0.], [0.]]), chi=0.0, rMat_c=array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]))[source]
from ‘eta’ frame out to lab (with handy kwargs to go to crystal or sample)
setting omega to zero in ang imput and omitting rMat_c leaves in the lab frame in accordance with beam frame specs.
- hexrd.transforms.old_xfcapi.angularDifference(angList0, angList1, units='radians')[source]
Do the proper (acute) angular difference in the context of a branch cut.
*) Default angular range is [-pi, pi]
- hexrd.transforms.old_xfcapi.arccosSafe(temp)[source]
Protect against numbers slightly larger than 1 due to round-off
- hexrd.transforms.old_xfcapi.columnNorm(a)[source]
normalize array of column vectors (hstacked, axis = 0)
- hexrd.transforms.old_xfcapi.detectorXYToGvec(xy_det, rMat_d, rMat_s, tVec_d, tVec_s, tVec_c, beamVec=array([[-0.], [-0.], [-1.]]), etaVec=array([[1.], [0.], [0.]]))[source]
Takes a list cartesian (x, y) pairs in the detector coordinates and calculates the associated reciprocal lattice (G) vectors and (bragg angle, azimuth) pairs with respect to the specified beam and azimth (eta) reference directions
Required Arguments: xy_det – (n, 2) ndarray or list-like input of n detector (x, y) points rMat_d – (3, 3) ndarray, the COB taking DETECTOR FRAME components
to LAB FRAME
- rMat_s – (3, 3) ndarray, the COB taking SAMPLE FRAME components
to LAB FRAME
- tVec_d – (3, 1) ndarray, the translation vector connecting
LAB to DETECTOR in LAB
- tVec_s – (3, 1) ndarray, the translation vector connecting
LAB to SAMPLE in LAB
- tVec_c – (3, 1) ndarray, the translation vector connecting
SAMPLE to CRYSTAL in SAMPLE
Optional Keyword Arguments: beamVec – (3, 1) mdarray containing the incident beam direction
components in the LAB FRAME
- etaVec – (3, 1) mdarray containing the reference azimuth direction
components in the LAB FRAME
Outputs: (n, 2) ndarray containing the (tTh, eta) pairs associated with each (x, y) (n, 3) ndarray containing the associated G vector directions in the LAB FRAME associated with gVecs
- hexrd.transforms.old_xfcapi.detectorXYToGvecArray(xy_det, rMat_d, rMat_s, tVec_d, tVec_s, tVec_c, beamVec=array([[-0.], [-0.], [-1.]]), etaVec=array([[1.], [0.], [0.]]))[source]
Takes a list cartesian (x, y) pairs in the detector coordinates and calculates the associated reciprocal lattice (G) vectors and (bragg angle, azimuth) pairs with respect to the specified beam and azimth (eta) reference directions
Required Arguments: xy_det – (n, 2) ndarray or list-like input of n detector (x, y) points rMat_d – (3, 3) ndarray, the COB taking DETECTOR FRAME components
to LAB FRAME
- rMat_s – (n, 3, 3) ndarray, the COB taking SAMPLE FRAME components
to LAB FRAME
- tVec_d – (3, 1) ndarray, the translation vector connecting
LAB to DETECTOR in LAB
- tVec_s – (3, 1) ndarray, the translation vector connecting
LAB to SAMPLE in LAB
- tVec_c – (3, 1) ndarray, the translation vector connecting
SAMPLE to CRYSTAL in SAMPLE
Optional Keyword Arguments: beamVec – (3, 1) mdarray containing the incident beam direction
components in the LAB FRAME
- etaVec – (3, 1) mdarray containing the reference azimuth direction
components in the LAB FRAME
Outputs: (n, 2) ndarray containing the (tTh, eta) pairs associated with each (x, y) (n, 3) ndarray containing the associated G vector directions in the LAB FRAME associated with gVecs
- hexrd.transforms.old_xfcapi.gvecToDetectorXY(gVec_c, rMat_d, rMat_s, rMat_c, tVec_d, tVec_s, tVec_c, beamVec=array([[-0.], [-0.], [-1.]]))[source]
Takes a list of unit reciprocal lattice vectors in crystal frame to the specified detector-relative frame, subject to the conditions:
the reciprocal lattice vector must be able to satisfy a bragg condition
the associated diffracted beam must intersect the detector plane
Required Arguments: gVec_c – (n, 3) ndarray of n reciprocal lattice vector components
in the CRYSTAL FRAME
- rMat_d – (3, 3) ndarray, the COB taking DETECTOR FRAME components
to LAB FRAME
- rMat_s – (3, 3) ndarray, the COB taking SAMPLE FRAME components
to LAB FRAME
- rMat_c – (3, 3) ndarray, the COB taking CRYSTAL FRAME components
to SAMPLE FRAME
- tVec_d – (3, 1) ndarray, the translation vector connecting
LAB to DETECTOR
- tVec_s – (3, 1) ndarray, the translation vector connecting
LAB to SAMPLE
- tVec_c – (3, 1) ndarray, the translation vector connecting
SAMPLE to CRYSTAL
Outputs: (m, 2) ndarray containing the intersections of m <= n diffracted beams associated with gVecs
- hexrd.transforms.old_xfcapi.gvecToDetectorXYArray(gVec_c, rMat_d, rMat_s, rMat_c, tVec_d, tVec_s, tVec_c, beamVec=array([[-0.], [-0.], [-1.]]))[source]
Takes a list of unit reciprocal lattice vectors in crystal frame to the specified detector-relative frame, subject to the conditions:
the reciprocal lattice vector must be able to satisfy a bragg condition
the associated diffracted beam must intersect the detector plane
Required Arguments: gVec_c – (n, 3) ndarray of n reciprocal lattice vector components
in the CRYSTAL FRAME
- rMat_d – (3, 3) ndarray, the COB taking DETECTOR FRAME components
to LAB FRAME
- rMat_s – (n, 3, 3) ndarray of n COB taking SAMPLE FRAME components
to LAB FRAME
- rMat_c – (3, 3) ndarray, the COB taking CRYSTAL FRAME components
to SAMPLE FRAME
- tVec_d – (3, 1) ndarray, the translation vector connecting
LAB to DETECTOR in LAB
- tVec_s – (3, 1) ndarray, the translation vector connecting
LAB to SAMPLE in LAB
- tVec_c – (3, 1) ndarray, the translation vector connecting
SAMPLE to CRYSTAL in SAMPLE
Outputs: (m, 2) ndarray containing the intersections of m <= n diffracted beams associated with gVecs
- hexrd.transforms.old_xfcapi.homochoricOfQuat(quats)[source]
Compute homochoric parameters of unit quaternions
quats is (4, n)
- hexrd.transforms.old_xfcapi.makeDetectorRotMat(tiltAngles)[source]
Form the (3, 3) tilt rotations from the tilt angle list:
tiltAngles = [gamma_Xl, gamma_Yl, gamma_Zl] in radians
- hexrd.transforms.old_xfcapi.makeGVector(hkl, bMat)[source]
take a CRYSTAL RELATIVE B matrix onto a list of hkls to output unit reciprocal lattice vectors (a.k.a. lattice plane normals)
Required Arguments: hkls – (3, n) ndarray of n hstacked reciprocal lattice vector component
triplets
- bMat – (3, 3) ndarray representing the matirix taking reciprocal lattice
vectors to the crystal reference frame
Output: gVecs – (3, n) ndarray of n unit reciprocal lattice vectors
(a.k.a. lattice plane normals)
To Do: * might benefit from some assert statements to catch improperly shaped
input.
- hexrd.transforms.old_xfcapi.makeOscillRotMatArray(chi, omeArray)[source]
Applies makeOscillAngles multiple times, for one chi value and an array of omega values.
- hexrd.transforms.old_xfcapi.makeRotMatOfExpMap(expMap)[source]
make a rotation matrix from an exponential map
- hexrd.transforms.old_xfcapi.makeRotMatOfQuat(quats)[source]
make rotation matrix from vstacked unit quaternions
- hexrd.transforms.old_xfcapi.mapAngle(ang, *args, **kwargs)[source]
Utility routine to map an angle into a specified period
- hexrd.transforms.old_xfcapi.oscillAnglesOfHKLs(hkls, chi, rMat_c, bMat, wavelength, vInv=None, beamVec=array([[-0.], [-0.], [-1.]]), etaVec=array([[1.], [0.], [0.]]))[source]
Takes a list of unit reciprocal lattice vectors in crystal frame to the specified detector-relative frame, subject to the conditions:
the reciprocal lattice vector must be able to satisfy a bragg condition
the associated diffracted beam must intersect the detector plane
Required Arguments: hkls – (n, 3) ndarray of n reciprocal lattice vectors
in the CRYSTAL FRAME
- chi – float representing the inclination angle of the
oscillation axis (std coords)
- rMat_c – (3, 3) ndarray, the COB taking CRYSTAL FRAME components
to SAMPLE FRAME
- bMat – (3, 3) ndarray, the COB taking RECIPROCAL LATTICE components
to CRYSTAL FRAME
wavelength – float representing the x-ray wavelength in Angstroms
Optional Keyword Arguments: beamVec – (3, 1) mdarray containing the incident beam direction
components in the LAB FRAME
- etaVec – (3, 1) mdarray containing the reference azimuth direction
components in the LAB FRAME
Outputs: ome0 – (n, 3) ndarray containing the feasible (tTh, eta, ome) triplets
for each input hkl (first solution)
- ome1 – (n, 3) ndarray containing the feasible (tTh, eta, ome) triplets
for each input hkl (second solution)
Notes:
The reciprocal lattice vector, G, will satisfy the the Bragg condition when:
b.T * G / ||G|| = -sin(theta)
where b is the incident beam direction (k_i) and theta is the Bragg angle consistent with G and the specified wavelength. The components of G in the lab frame in this case are obtained using the crystal orientation, Rc, and the single-parameter oscillation matrix, Rs(ome):
Rs(ome) * Rc * G / ||G||
The equation above can be rearranged to yield an expression of the form:
a*sin(ome) + b*cos(ome) = c
which is solved using the relation:
a*sin(x) + b*cos(x) = sqrt(a**2 + b**2) * sin(x + alpha)
—> sin(x + alpha) = c / sqrt(a**2 + b**2)
where:
alpha = atan2(b, a)
The solutions are:
/ | arcsin(c / sqrt(a**2 + b**2)) - alpha
- x = <
- pi - arcsin(c / sqrt(a**2 + b**2)) - alpha
There is a double root in the case the reflection is tangent to the Debye-Scherrer cone (c**2 = a**2 + b**2), and no solution if the Laue condition cannot be satisfied (filled with NaNs in the results array here)