diffcalc.hkl.geometry¶
Module providing diffractometer position definition and rotation matrices.
Diffractometer axes and rotation matrix definitions are following conventions described in [1].
References
- 1
H. You. “Angle calculations for a ‘4S+2D’ six-circle diffractometer” J. Appl. Cryst. (1999). 32, 614-623.
Functions
|
Calculate scattering vector in laboratory frame. |
Create rotation matrices corresponding to the diffractometer axes. |
|
|
Return rotation matrix corresponding to chi axis. |
|
Return rotation matrix corresponding to delta axis. |
|
Return rotation matrix corresponding to eta axis. |
|
Return rotation matrix corresponding to mu axis. |
|
Return rotation matrix corresponding to nu axis. |
|
Return rotation matrix corresponding to phi axis. |
Classes
|
Class representing diffractometer orientation. |
- class diffcalc.hkl.geometry.Position(mu: float = 0.0, delta: float = 0.0, nu: float = 0.0, eta: float = 0.0, chi: float = 0.0, phi: float = 0.0, indegrees: bool = True)[source]¶
Class representing diffractometer orientation.
Diffractometer orientation corresponding to (4+2) geometry defined in H. You paper (add reference)
- fields¶
Tuple with angle names
- Type
Tuple[str, str, str, str, str, str]
- mu¶
mu angle value
- Type
float, default = 0.0
- delta¶
delta angle value
- Type
float, default = 0.0
- nu¶
nu angle value
- Type
float, default = 0.0
- eta¶
eta angle value
- Type
float, default = 0.0
- chi¶
chi angle value
- Type
float, default = 0.0
- phi¶
phi angle value
- Type
float, default = 0.0
- indegrees¶
If True, arguments are angles in degrees.
- Type
bool, default = True
- Attributes
Methods
asdegrees(pos)Create new Position object with angles in degrees.
asradians(pos)Create new Position object with angles in radians.
- fields: Tuple[str, str, str, str, str, str] = ('mu', 'delta', 'nu', 'eta', 'chi', 'phi')¶
- classmethod asdegrees(pos: Position) Position[source]¶
Create new Position object with angles in degrees.
- classmethod asradians(pos: Position) Position[source]¶
Create new Position object with angles in radians.
- property mu: Optional[float]¶
Value of of mu angle.
- property delta: Optional[float]¶
Value of of delta angle.
- property nu: Optional[float]¶
Value of of nu angle.
- property eta: Optional[float]¶
Value of of eta angle.
- property chi: Optional[float]¶
Value of of chi angle.
- property phi: Optional[float]¶
Value of of phi angle.
- property asdict: Dict[str, float]¶
Return dictionary of diffractometer angles.
- Returns
Dictionary of axis names and angle values.
- Return type
Dict[str, float]
- property astuple: Tuple[float, float, float, float, float, float]¶
Return tuple of diffractometer angles.
- Returns
Tuple of angle values.
- Return type
Tuple[float, float, float, float, float, float]
- diffcalc.hkl.geometry.get_rotation_matrices(pos: Position) Tuple[ndarray, ndarray, ndarray, ndarray, ndarray, ndarray][source]¶
Create rotation matrices corresponding to the diffractometer axes.
- Parameters
pos (Position) – Position object containing set of diffractometer angles
- Returns
np.ndarray, np.ndarray, np.ndarray, np.ndarray] Tuple containing set of rotation matrices corresponding to input diffractometer angle values.
- Return type
Tuple[np.ndarray, np.ndarray,
- diffcalc.hkl.geometry.rot_NU(nu: float) ndarray[source]¶
Return rotation matrix corresponding to nu axis.
- Parameters
nu (float) –
angle (nu axis) –
- Returns
Rotation matrix as a NumPy array.
- Return type
np.ndarray
- diffcalc.hkl.geometry.rot_DELTA(delta: float) ndarray[source]¶
Return rotation matrix corresponding to delta axis.
- Parameters
delta (float) –
angle (delta axis) –
- Returns
Rotation matrix as a NumPy array.
- Return type
np.ndarray
- diffcalc.hkl.geometry.rot_MU(mu_or_alpha: float) ndarray[source]¶
Return rotation matrix corresponding to mu axis.
- Parameters
mu (float) –
angle (mu axis) –
- Returns
Rotation matrix as a NumPy array.
- Return type
np.ndarray
- diffcalc.hkl.geometry.rot_ETA(eta: float) ndarray[source]¶
Return rotation matrix corresponding to eta axis.
- Parameters
eta (float) –
angle (eta axis) –
- Returns
Rotation matrix as a NumPy array.
- Return type
np.ndarray
- diffcalc.hkl.geometry.rot_CHI(chi: float) ndarray[source]¶
Return rotation matrix corresponding to chi axis.
- Parameters
chi (float) –
angle (chi axis) –
- Returns
Rotation matrix as a NumPy array.
- Return type
np.ndarray
- diffcalc.hkl.geometry.rot_PHI(phi: float) ndarray[source]¶
Return rotation matrix corresponding to phi axis.
- Parameters
phi (float) –
angle (phi axis) –
- Returns
Rotation matrix as a NumPy array.
- Return type
np.ndarray
- diffcalc.hkl.geometry.get_q_phi(pos: Position) ndarray[source]¶
Calculate scattering vector in laboratory frame.
Calculate hkl in the phi frame in units of 2 * pi / lambda.
- Parameters
pos (object) – Diffractometer angles in radians.
- Returns
Scattering vector coordinates corresponding to the input position.
- Return type
matrix