rotations¶
Functions to calculate rotation matrices.
detector_wavevector(delta, gamma, wavelength_a)
¶
Calculate wavevector in diffractometer axis using detector angles
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
delta
|
float angle in degrees in vertical direction (about diff-z) |
required | |
gamma
|
float angle in degrees in horizontal direction (about diff-x) |
required | |
wavelength_a
|
float wavelength in A |
required |
Returns:
| Type | Description |
|---|---|
|
[1*3] wavevector position in A-1 == kf - ki |
Source code in mmg_toolbox/utils/rotations.py
diffractometer(vec, phi, chi, eta, mu)
¶
Perform an intrinsic rotation using You et al. 4S+2D diffractometer mu right-handed rotation about x eta left-handed rotation about z' chi right-handed rotation about y'' phi left-handed rotation about z''' Z = MU.ETA.CHI.PHI Angles in degrees vec must be 1D or column vector (3*n)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vec
|
[3*n] vector in the sample frame |
required | |
phi
|
float angle in degrees, left handed roation about z''' |
required | |
chi
|
float angle in degrees, right handed rotation about y'' |
required | |
eta
|
float angle in degrees, left handed rotation about z' |
required | |
mu
|
float angle in degrees, right handed rotation about x |
required |
Returns:
| Type | Description |
|---|---|
|
[3*n] vector in the diffractometer frame |
Source code in mmg_toolbox/utils/rotations.py
diffractometer2hkl(ub, phi=0, chi=0, eta=0, mu=0, delta=0, gamma=0, wavelength=1.0)
¶
Return [h,k,l] position of diffractometer axes with given UB and wavelength
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ub
|
[3*3] array UB orientation matrix following Busing & Levy |
required | |
phi
|
float sample angle in degrees |
0
|
|
chi
|
float sample angle in degrees |
0
|
|
eta
|
float sample angle in degrees |
0
|
|
mu
|
float sample angle in degrees |
0
|
|
delta
|
float detector angle in degrees |
0
|
|
gamma
|
float detector angle in degrees |
0
|
|
wavelength
|
float wavelength in A |
1.0
|
Returns:
| Type | Description |
|---|---|
|
[h,k,l] |
Source code in mmg_toolbox/utils/rotations.py
rot_matrix(angle_rad, axis=(0, 0, 1))
¶
Generate rotation matrix about arbitary axis https://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle
Source code in mmg_toolbox/utils/rotations.py
rotation_t_matrix(value=0.0, vector=(0, 0, 1), offset=(0, 0, 0))
¶
Create 4x4 transformation matrix including a rotation
Source code in mmg_toolbox/utils/rotations.py
rotmatrix_diffractometer(phi, chi, eta, mu)
¶
an intrinsic rotation using You et al. 4S+2D diffractometer mu right-handed rotation about x eta left-handed rotation about z' chi right-handed rotation about y'' phi left-handed rotation about z''' Angles in degrees Z = MU.ETA.CHI.PHI V' = Z.V || rot_vec = np.dot(r, vec)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
phi
|
float left-handed rotation about z''' angle in degrees |
required | |
chi
|
float right-handed rotation about y'' angle in degrees |
required | |
eta
|
float left-handed rotation about z' angle in degrees |
required | |
mu
|
float right-handed rotation about x angle in degrees |
required |
Returns:
| Type | Description |
|---|---|
|
[3*3] array |
Source code in mmg_toolbox/utils/rotations.py
rotmatrix_intrinsic(alpha, beta, gamma)
¶
a rotation whose yaw, pitch, and roll angles are α, β and γ, respectively. More formally, it is an intrinsic rotation whose Tait–Bryan angles are α, β, γ, about axes z, y, x, respectively. https://en.wikipedia.org/wiki/Rotation_matrix#General_rotations
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
float yaw angle in degrees |
required | |
beta
|
float pitch angle in degrees |
required | |
gamma
|
float gamma angle in degrees |
required |
Returns:
| Type | Description |
|---|---|
|
[3*3] array |
Source code in mmg_toolbox/utils/rotations.py
rotmatrix_x(mu)
¶
Generate rotation matrix of mu Deg about x-axis (right handed) Equivalent to ROLL in the Tain-Bryan convention Equivalent to mu in You et al. diffractometer convention (right handed)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mu
|
float angle in degrees |
required |
Returns:
| Type | Description |
|---|---|
|
[3*3] array |
Source code in mmg_toolbox/utils/rotations.py
rotmatrix_y(chi)
¶
Generate rotation matrix of chi Deg about y-axis (right handed) Equivalent to PITCH in the Tain-Bryan convention Equivalent to chi in You et al. diffractometer convention (right handed)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chi
|
float angle in degrees |
required |
Returns:
| Type | Description |
|---|---|
|
[3*3] array |
Source code in mmg_toolbox/utils/rotations.py
rotmatrix_z(phi)
¶
Generate rotation matrix of phi Deg about z-axis (right handed) Equivalent to YAW in the Tain-Bryan convention Equivalent to -phi, -eta, -delta in You et al. diffractometer convention (left handed)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
phi
|
float angle in degrees |
required |
Returns:
| Type | Description |
|---|---|
|
[3*3] array |
Source code in mmg_toolbox/utils/rotations.py
translation_t_matrix(value=0.0, vector=(0, 0, 1), offset=(0, 0, 0))
¶
Create 4x4 transformation matrix including a translation