id4_common.utils.hkl_utils_hklpy2#

Auxilary HKL functions.

Module Contents#

id4_common.utils.hkl_utils_hklpy2.logger#
id4_common.utils.hkl_utils_hklpy2.polar_config#
id4_common.utils.hkl_utils_hklpy2.fourc_config#
id4_common.utils.hkl_utils_hklpy2.pbar_manager#
id4_common.utils.hkl_utils_hklpy2.POLAR_DIFFRACTOMETER = 'huber_euler'#
id4_common.utils.hkl_utils_hklpy2.fourc = None#
id4_common.utils.hkl_utils_hklpy2.get_huber_euler()#

Return the huber_euler diffractometer from the device registry.

id4_common.utils.hkl_utils_hklpy2.get_huber_hp()#

Return the huber_hp diffractometer from the device registry.

id4_common.utils.hkl_utils_hklpy2.get_huber_euler_psi()#

Return the huber_euler_psi diffractometer from the device registry.

id4_common.utils.hkl_utils_hklpy2.select_engine_for_psi(instrument=None)#

Name the diffractometer to be used.

id4_common.utils.hkl_utils_hklpy2.engine_for_psi()#

Return the currently-selected psi calc engine (or None).

id4_common.utils.hkl_utils_hklpy2.set_diffractometer(instrument=None)#

Name the diffractometer to be used.

id4_common.utils.hkl_utils_hklpy2.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_hklpy2.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_hklpy2.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_hklpy2.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_hklpy2.or_swap()#

Swaps the two orientation reflections in hklpy.

id4_common.utils.hkl_utils_hklpy2.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_hklpy2.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_hklpy2.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_hklpy2.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_hklpy2.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_hklpy2.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_hklpy2.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_hklpy2.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_hklpy2.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_hklpy2.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_hklpy2.ca(h, k, l, energy=None)#

Calculate the motors position of a reflection.

Parameters:
  • h (float) – H, K, and L values.

  • k (float) – H, K, and L values.

  • l (float) – H, K, and L values.

  • energy (float) – energy (Optional)

id4_common.utils.hkl_utils_hklpy2.ubr(h, k, l)#

Move the motors to a reciprocal space point.

Parameters:
  • h (float) – H, K, and L values.

  • k (float) – H, K, and L values.

  • l (float) – H, K, and L values.

id4_common.utils.hkl_utils_hklpy2.br(h, k, l)#

Move the motors to a reciprocal space point.

Parameters:
  • h (float) – H, K, and L values.

  • k (float) – H, K, and L values.

  • l (float) – H, K, and L values.

Return type:

Generator for the bluesky Run Engine.

id4_common.utils.hkl_utils_hklpy2.uan(*args)#

Moves the delta and theta motors.

WARNING: This function will only work with six circles. This will be fixed in future releases.

Parameters:
  • gamma (float, optional??) – Delta and th motor angles to be moved to.

  • mu (float, optional??) – Delta and th motor angles to be moved to.

id4_common.utils.hkl_utils_hklpy2.an(*args)#

Moves the delta and theta motors.

WARNING: This function will only work with six circles. This will be fixed in future releases.

Parameters:
  • delta (float, optional??) – Delta and th motor angles to be moved to.

  • th (float, optional??) – Delta and th motor angles to be moved to.

Return type:

Generator for the bluesky Run Engine.

id4_common.utils.hkl_utils_hklpy2.pa_new()#

Retrieve information on the current reciprocal space position.

id4_common.utils.hkl_utils_hklpy2.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_hklpy2.setaz(*args)#

Set the azimuthal reference vector (h k l) for psi-constant mode.

id4_common.utils.hkl_utils_hklpy2.freeze(*args)#

Freeze the psi angle for psi-constant scans on the current diffractometer.

id4_common.utils.hkl_utils_hklpy2.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_hklpy2.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_hklpy2.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_hklpy2.show_constraints()#

Show constraints and freeze angles (value)

id4_common.utils.hkl_utils_hklpy2.reset_constraints()#

Reset all constraints

id4_common.utils.hkl_utils_hklpy2.set_constraints(*args)#

Change constraint values for specific axis

class id4_common.utils.hkl_utils_hklpy2.whClass#

_wh function used without parenthesis

id4_common.utils.hkl_utils_hklpy2.wh#
class id4_common.utils.hkl_utils_hklpy2.sampleListClass#

_sampleList function used without parenthesis

id4_common.utils.hkl_utils_hklpy2.sampleList#
class id4_common.utils.hkl_utils_hklpy2.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_hklpy2.restore_huber_from_scan(scan_id, diffractometer=None, sample_name=None, force=False)#

Restore diffractometer orientation (sample, constraints, reflections) from a saved scan.