calc

class hkl.calc.CalcE4CH(**kwargs)
class hkl.calc.CalcE4CV(**kwargs)
class hkl.calc.CalcE6C(**kwargs)
class hkl.calc.CalcK4CV(**kwargs)
class hkl.calc.CalcK6C(**kwargs)
class hkl.calc.CalcMed2p3(**kwargs)
class hkl.calc.CalcPetra3_p09_eh2(**kwargs)
class hkl.calc.CalcRecip(dtype, engine='hkl', sample='main', lattice=None, degrees=True, units='user', lock_engine=False, inverted_axes=None)

Reciprocal space calculations

Parameters
  • dtype (str) – Diffractometer type (usually specified by a subclass)

  • engine (str, optional) – ‘hkl’, for example

  • sample (str, optional) – Default sample name (default: ‘main’)

  • lattice (Lattice, optional) – Lattice to use with the default sample

  • degrees (bool, optional) – Use degrees instead of radians (default: True)

  • units ({'user', }) – The type of units to use internally

  • lock_engine (bool, optional) – Don’t allow the engine to be changed during the life of this object

  • inverted_axes (list, optional) – Names of axes to invert the sign of

property Position

Dynamically-generated physical motor position class

add_sample(sample, select=True)

Add an HklSample

Parameters
  • sample (HklSample instance) – The sample name, or optionally an already-created HklSample instance

  • select (bool, optional) – Select the sample to focus calculations on

property energy

The energy associated with the geometry, in keV

property engine_locked

If set, do not allow the engine to be changed post-initialization

forward(position, engine=None)

Forward-calculate a position from pseudo to real space

forward_iter(start, end, max_iters, *, threshold=0.99, decision_fcn=None)

Iteratively attempt to go from a pseudo start -> end position

For every solution failure, the position is moved back. For every success, the position is moved closer to the destination.

After up to max_iters, the position can be reached, the solutions will be returned. Otherwise, ValueError will be raised stating the last position that was reachable and the corresponding motor positions.

Parameters
  • start (Position) –

  • end (Position) –

  • max_iters (int) – Maximum number of iterations

  • threshold (float, optional) – Normalized proximity to end position to stop iterating

  • decision_fcn (callable, optional) –

    Function to choose a solution from several. Defaults to picking the first solution. The signature of the function should be as follows:

    >> def decision(pseudo_position, solution_list): >> return solution_list[0]

Returns

solutions

Return type

list

Raises

UnreachableError (ValueError) – Position cannot be reached The last valid HKL position and motor positions are accessible in this exception instance.

property inverted_axes

The physical axis names to invert

new_sample(name, select=True, **kwargs)

Convenience function to add a sample by name

Keyword arguments are passed to the new HklSample initializer.

Parameters
  • name (str) – The sample name

  • select (bool, optional) – Select the sample to focus calculations on

property physical_axes

Physical (real) motor positions as an OrderedDict

property physical_positions

Physical (real) motor positions

property pseudo_axes

Ordered dictionary of axis name to position

property pseudo_axis_names

Pseudo axis names from the current engine

property pseudo_positions

Pseudo axis positions/values from the current engine

property sample_name

The name of the currently selected sample

property units

The units used for calculations

update()

Calculate the pseudo axis positions from the real axis positions

property wavelength

The wavelength associated with the geometry, in angstrom

class hkl.calc.CalcSoleilMars(**kwargs)
class hkl.calc.CalcSoleilSiriusKappa(**kwargs)
class hkl.calc.CalcSoleilSiriusTurret(**kwargs)
class hkl.calc.CalcSoleilSixs(**kwargs)
class hkl.calc.CalcSoleilSixsMed1p2(**kwargs)
class hkl.calc.CalcSoleilSixsMed2p2(**kwargs)
class hkl.calc.CalcTwoC(**kwargs)
class hkl.calc.CalcZaxis(**kwargs)
exception hkl.calc.UnreachableError(msg, pseudo, physical)

Position is unreachable.

pseudo

Last reachable pseudo position in the trajectory

Type

sequence

physical

Corresponding physical motor positions

Type

sequence

hkl.calc.default_decision_function(position, solutions)

The default decision function - returns the first solution