id4_common.utils.hkl_utils#
Auxilary HKL functions.
Module Contents#
- id4_common.utils.hkl_utils.logger#
- id4_common.utils.hkl_utils.polar_config#
- id4_common.utils.hkl_utils.fourc_config#
- id4_common.utils.hkl_utils.pbar_manager#
- id4_common.utils.hkl_utils.POLAR_DIFFRACTOMETER = 'huber_euler'#
- id4_common.utils.hkl_utils.fourc = None#
- id4_common.utils.hkl_utils.get_huber_euler()#
Return the huber_euler diffractometer from the device registry.
- id4_common.utils.hkl_utils.get_huber_hp()#
Return the huber_hp diffractometer from the device registry.
- id4_common.utils.hkl_utils.get_huber_euler_psi()#
Return the huber_euler_psi diffractometer from the device registry.
- id4_common.utils.hkl_utils.select_engine_for_psi(instrument=None)#
Name the diffractometer to be used.
- id4_common.utils.hkl_utils.engine_for_psi()#
Return the currently-selected psi calc engine (or
None).
- id4_common.utils.hkl_utils.set_diffractometer(instrument=None)#
Name the diffractometer to be used.
- id4_common.utils.hkl_utils.sampleNew(*args)#
Set the lattice constants.
- Parameters:
a (float, optional) – Lattice constants. If None, it will ask for input.
b (float, optional) – Lattice constants. If None, it will ask for input.
c (float, optional) – Lattice constants. If None, it will ask for input.
alpha (float, optional) – Lattice constants. If None, it will ask for input.
beta (float, optional) – Lattice constants. If None, it will ask for input.
gamma (float, optional) – Lattice constants. If None, it will ask for input.
- id4_common.utils.hkl_utils.sampleChange(sample_key=None)#
Change 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.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.list_reflections(all_samples=False)#
Lists all reflections in defined in hklpy.
WARNING: This function will only work with six circles. This will be fixed in future releases.
- Parameters:
all_samples (boolean, optional) – If True, it will list the reflections for all samples, if False, only the current sample. Defaults to False.
- id4_common.utils.hkl_utils.or_swap()#
Swaps the two orientation reflections in hklpy.
- id4_common.utils.hkl_utils.setor0(*args)#
Sets the primary orientation in hklpy.
WARNING: This function will only work with six circles. This will be fixed in future releases.
- Parameters:
delta (float, optional) – Values of motor positions for current reflection. If None, it will ask for it.
th (float, optional) – Values of motor positions for current reflection. If None, it will ask for it.
chi (float, optional) – Values of motor positions for current reflection. If None, it will ask for it.
phi (float, optional) – Values of motor positions for current reflection. If None, it will ask for it.
gamma (float, optional) – Values of motor positions for current reflection. If None, it will ask for it.
mu (float, optional) – Values of motor positions for current reflection. If None, it will ask for it.
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.setor1(*args)#
Sets the primary secondary in hklpy.
WARNING: This function will only work with six circles. This will be fixed in future releases.
- Parameters:
delta (float, optional) – Values of motor positions for current reflection. If None, it will ask for it.
th (float, optional) – Values of motor positions for current reflection. If None, it will ask for it.
chi (float, optional) – Values of motor positions for current reflection. If None, it will ask for it.
phi (float, optional) – Values of motor positions for current reflection. If None, it will ask for it.
gamma (float, optional) – Values of motor positions for current reflection. If None, it will ask for it.
mu (float, optional) – Values of motor positions for current reflection. If None, it will ask for it.
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.set_orienting()#
Change the primary and/or secondary orienting reflections to existing reflecitons in reflection list in hklpy.
WARNING: This function will only work with six circles. This will be fixed in future releases.
- id4_common.utils.hkl_utils.del_reflection()#
Delete existing reflection from in reflection list in hklpy.
WARNING: This function will only work with six circles. This will be fixed in future releases.
- id4_common.utils.hkl_utils.list_orienting(all_samples=False)#
Prints the two reflections used in the UB matrix.
WARNING: This function will only work with six circles. This will be fixed in future releases.
- Parameters:
all_samples (boolean, optional) – If True, it will print the reflections of all samples, if False, only of the current one.
- id4_common.utils.hkl_utils.or0(h=None, k=None, l=None)#
Sets the primary orientation in hklpy using the current motor positions.
WARNING: This function will only work with six circles. This will be fixed in future releases.
- 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.or1(h=None, k=None, l=None)#
Sets the secondary orientation in hklpy using the current motor positions.
WARNING: This function will only work with six circles. This will be fixed in future releases.
- 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.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.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.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.ca(h, k, l, energy=None)#
Calculate the motors position of a reflection.
- id4_common.utils.hkl_utils.ubr(h, k, l)#
Move the motors to a reciprocal space point.
- id4_common.utils.hkl_utils.br(h, k, l)#
Move the motors to a reciprocal space point.
- id4_common.utils.hkl_utils.uan(*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.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.pa_new()#
Retrieve information on the current reciprocal space position.
- id4_common.utils.hkl_utils.setlat(*args)#
Set the lattice constants.
- Parameters:
a (float, optional) – Lattice constants. If None, it will ask for input.
b (float, optional) – Lattice constants. If None, it will ask for input.
c (float, optional) – Lattice constants. If None, it will ask for input.
alpha (float, optional) – Lattice constants. If None, it will ask for input.
beta (float, optional) – Lattice constants. If None, it will ask for input.
gamma (float, optional) – Lattice constants. If None, it will ask for input.
- id4_common.utils.hkl_utils.setaz(*args)#
Set the azimuthal reference vector (h k l) for psi-constant mode.
- id4_common.utils.hkl_utils.freeze(*args)#
Freeze the psi angle for psi-constant scans on the current diffractometer.
- id4_common.utils.hkl_utils.update_lattice(lattice_constant=None)#
Update lattice constants.
- Parameters:
lattice_constant (string, optional) – a, b or c or auto (default)
- id4_common.utils.hkl_utils.write_config(method='File', overwrite=False)#
Write configuration from file in current directory.
- Parameters:
method (string, optional) – right now only “File” possible, but later PV or other
overwrite (Boolean, optional) – asks if existing file hould be overwritten
- id4_common.utils.hkl_utils.read_config(method='File')#
Read configuration from file in current directory.
- Parameters:
method (string, optional) – right now only “File” possible, but later PV or other
- id4_common.utils.hkl_utils.show_constraints()#
Show constraints and freeze angles (value)
- id4_common.utils.hkl_utils.reset_constraints()#
Reset all constraints
- id4_common.utils.hkl_utils.set_constraints(*args)#
Change constraint values for specific axis
- class id4_common.utils.hkl_utils.whClass#
_wh function used without parenthesis
- id4_common.utils.hkl_utils.wh#
- class id4_common.utils.hkl_utils.sampleListClass#
_sampleList function used without parenthesis
- id4_common.utils.hkl_utils.sampleList#
- class id4_common.utils.hkl_utils.Sync_UB_Matrix(source: hkl.diffract.Diffractometer, target: hkl.diffract.Diffractometer)#
Copy the UB matrix from source to target diffractometers.
- source#
- target#
- cleanup(*args, **kwargs)#
Remove all our subscriptions to ophyd objects.
- sync_callback(value=None, **kwargs)#
Copy the UB matrix from source to target when a change is received.
- id4_common.utils.hkl_utils.restore_huber_from_scan(scan_id, diffractometer=None, sample_name=None, force=False)#
Restore diffractometer orientation (sample, constraints, reflections) from a saved scan.