id4_common.utils.hkl_utils_new#
Auxilary HKL functions.
Module Contents#
- id4_common.utils.hkl_utils_new.RE#
- id4_common.utils.hkl_utils_new.pbar_manager#
- class id4_common.utils.hkl_utils_new.Geometries(huber_euler, huber_euler_psi, huber_hp, huber_hp_psi)#
Register the diffractometer geometries.
- property huber_euler#
- property huber_euler_psi#
- property huber_hp#
- property huber_hp_psi#
- id4_common.utils.hkl_utils_new.geometries#
- id4_common.utils.hkl_utils_new.newsample()#
Interactively add a new sample with lattice constants.
- Prompts the user for:
sample name
lattice constants (a, b, c, alpha, beta, gamma)
Uses defaults if the user just presses Enter.
- id4_common.utils.hkl_utils_new.list_reflections(all_samples=False)#
Lists all reflections defined in hklpy for six-circle geometry.
- Parameters:
all_samples (bool, optional) – If True, list reflections for all samples. If False, only the current sample. Defaults to False.
- id4_common.utils.hkl_utils_new.sampleChange(sample_key=None)#
Change selected sample in hklpy2.
- Parameters:
sample_key (string, optional) – Name of the sample as set in hklpy. If None it will ask for which sample.
- id4_common.utils.hkl_utils_new.sampleRemove(sample_key=None)#
Remove selected sample in hklpy.
- Parameters:
sample_key (string, optional) – Name of the sample as set in hklpy. If None it will ask for which sample.
- id4_common.utils.hkl_utils_new.or_swap()#
Swaps the two orientation reflections in hklpy.
- id4_common.utils.hkl_utils_new.calc_UB(r1, r2, wavelength=None, output=False)#
Compute the UB matrix with two reflections.
- Parameters:
r1 (hklpy reflections) – Orienting reflections from hklpy.
r2 (hklpy reflections) – Orienting reflections from hklpy.
wavelength (float, optional) – This is not used…
output (boolean) – Toggle to decide whether to print the UB matrix.
- id4_common.utils.hkl_utils_new.compute_UB()#
Calculates the UB matrix.
This fixes one issue with the hklpy calc_UB in that using wh() right after will not work, it needs to run one calculation first.
- Parameters:
h (float, optional) – Values of H, K, L positions for current reflection. If None, it will ask for it.
k (float, optional) – Values of H, K, L positions for current reflection. If None, it will ask for it.
l (float, optional) – Values of H, K, L positions for current reflection. If None, it will ask for it.
- id4_common.utils.hkl_utils_new.setor0()#
Sets the primary orientation in hklpy2.
- Parameters:
motors (diffractometer real) – Values of motor positions for current reflection. It will ask for it.
h (float, optional) – Values of H, K, L positions for current reflection. It will ask for it.
k (float, optional) – Values of H, K, L positions for current reflection. It will ask for it.
l (float, optional) – Values of H, K, L positions for current reflection. It will ask for it.
- id4_common.utils.hkl_utils_new.setor1()#
Sets the primary orientation in hklpy2.
- Parameters:
motors (diffractometer real) – Values of motor positions for current reflection. It will ask for it.
h (float, optional) – Values of H, K, L positions for current reflection. It will ask for it.
k (float, optional) – Values of H, K, L positions for current reflection. It will ask for it.
l (float, optional) – Values of H, K, L positions for current reflection. It will ask for it.
- id4_common.utils.hkl_utils_new.or0(h=None, k=None, l=None)#
Sets the primary orientation in hklpy2 using the current motor positions.
- Parameters:
h (float, optional) – Values of H, K, L positions for current reflection. If None, it will ask for it.
k (float, optional) – Values of H, K, L positions for current reflection. If None, it will ask for it.
l (float, optional) – Values of H, K, L positions for current reflection. If None, it will ask for it.
- id4_common.utils.hkl_utils_new.or1(h=None, k=None, l=None)#
Sets the secondary orientation in hklpy2 using the current motor positions.
- Parameters:
h (float, optional) – Values of H, K, L positions for current reflection. If None, it will ask for it.
k (float, optional) – Values of H, K, L positions for current reflection. If None, it will ask for it.
l (float, optional) – Values of H, K, L positions for current reflection. If None, it will ask for it.
- id4_common.utils.hkl_utils_new.set_orienting()#
Change the primary and secondary orienting reflections to existing reflections in the reflection list (hklpy2).
WARNING: Works only with six-circle geometry (fix in progress).
- id4_common.utils.hkl_utils_new.del_reflection()#
Delete a reflection from the current sample’s reflection list.
Displays reflections like set_orienting()
User inputs index number of reflection to delete
Orienting reflections (first/second) cannot be deleted
- id4_common.utils.hkl_utils_new.list_orienting()#
List the first and second orienting reflections only from the current sample’s reflection list.
- id4_common.utils.hkl_utils_new.setmode(mode=None)#
Set the mode of the currently selected diffractometer.
WARNING: This function will only work with six circles. This will be fixed in future releases.
- Parameters:
mode (string, optional) – Mode to be selected. If None, it will ask.
- id4_common.utils.hkl_utils_new.ca(h, k, l)#
Calculate the motors position of a reflection.
- id4_common.utils.hkl_utils_new.ubr(h, k, l)#
Move the motors to a reciprocal space point.
- id4_common.utils.hkl_utils_new.br(h, k, l)#
Move the motors to a reciprocal space point.
- id4_common.utils.hkl_utils_new.uan(*args)#
Moves the delta and eta motors.
WARNING: This function will only work with six circles. This will be fixed in future releases.
- id4_common.utils.hkl_utils_new.an(*args)#
Moves the delta and theta motors.
WARNING: This function will only work with six circles. This will be fixed in future releases.
- id4_common.utils.hkl_utils_new.setlat(*args)#
Set the lattice constants for the current sample.
- Parameters:
a (float, optional) – Lattice constants. - If all 6 are provided as arguments, they are used directly. - If none are provided, the user will be prompted interactively.
b (float, optional) – Lattice constants. - If all 6 are provided as arguments, they are used directly. - If none are provided, the user will be prompted interactively.
c (float, optional) – Lattice constants. - If all 6 are provided as arguments, they are used directly. - If none are provided, the user will be prompted interactively.
alpha (float, optional) – Lattice constants. - If all 6 are provided as arguments, they are used directly. - If none are provided, the user will be prompted interactively.
beta (float, optional) – Lattice constants. - If all 6 are provided as arguments, they are used directly. - If none are provided, the user will be prompted interactively.
gamma (float, optional) – Lattice constants. - If all 6 are provided as arguments, they are used directly. - If none are provided, the user will be prompted interactively.
Notes
If two orienting reflections are defined, UB will be recomputed automatically.
- id4_common.utils.hkl_utils_new.setaz(*args)#
Set the azimuthal reference reflection (h2, k2, l2).
- Works differently depending on geometry:
4-circle: uses ‘psi_constant’
6-circle: uses ‘psi_constant_vertical’ and ‘psi_constant_horizontal’
- Parameters:
h2 (int or float, optional) – Miller indices of the azimuthal reference reflection. - If provided, these are used directly. - If not provided, the user will be prompted interactively.
k2 (int or float, optional) – Miller indices of the azimuthal reference reflection. - If provided, these are used directly. - If not provided, the user will be prompted interactively.
l2 (int or float, optional) – Miller indices of the azimuthal reference reflection. - If provided, these are used directly. - If not provided, the user will be prompted interactively.
- id4_common.utils.hkl_utils_new.freeze_psi(*args)#