diffcalc.hkl.calc¶
Routines for calculating miller indices and diffractometer positions.
Module implementing calculations based on UB matrix data and diffractometer constraints.
Classes
|
Class for converting between miller indices and diffractometer position. |
- class diffcalc.hkl.calc.HklCalculation(ubcalc, constraints)[source]¶
Class for converting between miller indices and diffractometer position.
- ubcalc¶
Reference to UBcalculation object containing UB matrix data.
- Type
UBcalculation
- constraints¶
Reference to Constraints object containing diffractometer constraint settings.
- get_hkl(pos: Position, wavelength: float) Tuple[float, float, float][source]¶
Calculate miller indices corresponding to a diffractometer positions.
- get_virtual_angles(pos: Position, asdegrees: bool = True) Dict[str, float][source]¶
Calculate pseudo-angles corresponding to a diffractometer position.
- Attributes
asdictSerialise the object into a JSON compatible dictionary.
Methods
fromdict(data)Construct HklCalculation instance from a JSON compatible dictionary.
get_hkl(pos, wavelength)Calculate miller indices corresponding to a diffractometer positions.
get_position(h, k, l, wavelength[, asdegrees])Calculate diffractometer position from miller indices and wavelength.
get_virtual_angles(pos[, asdegrees])Calculate pseudo-angles corresponding to a diffractometer position.
- get_hkl(pos: Position, wavelength: float) Tuple[float, float, float][source]¶
Calculate miller indices corresponding to a diffractometer positions.
- Parameters
pos (Position) – Diffractometer position.
- Returns
Miller indices corresponding to the specified diffractometer position at the given wavelength.
- Return type
Tuple[float, float, float]
- get_virtual_angles(pos: Position, asdegrees: bool = True) Dict[str, float][source]¶
Calculate pseudo-angles corresponding to a diffractometer position.
- Parameters
pos (Position) – Diffractometer position.
asdegrees (bool = True) – If True, return angles in degrees.
- Returns
Returns alpha, beta, betain, betaout, naz, psi, qaz, tau, theta and ttheta angles.
- Return type
Dict[str, float]
- get_position(h: float, k: float, l: float, wavelength: float, asdegrees: bool = True) List[Tuple[Position, Dict[str, float]]][source]¶
Calculate diffractometer position from miller indices and wavelength.
The calculated positions and angles are verified by checking that they map to the requested miller indices.
- Parameters
h (float) – h miller index.
k (float) – k miller index.
l (float) – l miller index.
wavelength (float) – wavelength in Angstroms.
asdegrees (bool) – If True, return angles in degrees.
- Returns
List of all solutions matching the input miller indices that consists of pairs of diffractometer position object and virtual angles dictionary.
- Return type
List[Tuple[Position, Dict[str, float]]]
- property asdict: Dict[str, Any]¶
Serialise the object into a JSON compatible dictionary.
- Returns
Dictionary containing properties of hkl class. Can be unpacked to recreate HklCalculation object using fromdict class method below.
- Return type
Dict[str, Any]
- classmethod fromdict(data: Dict[str, Any]) HklCalculation[source]¶
Construct HklCalculation instance from a JSON compatible dictionary.
- Parameters
data (Dict[str, Any]) – Dictionary containing properties of hkl class, must have the equivalent structure of asdict method above.
- Returns
Instance of this class created from the dictionary.
- Return type