hkl_soleil (HklSolver)#

home:

https://people.debian.org/~picca/hkl/hkl.html

source:

https://repo.or.cz/hkl.git

Caution

work-in-progress

Backend: Hkl ("hkl_soleil")

Caution

The hkl_soleil Solver is not available for Windows or Mac OS. The underlying Hkl/Soleil support library is only provided for Linux 64-bit OS at this time.

Example:

>>> import hklpy2
>>> SolverClass = hklpy2.get_solver("hkl_soleil")
>>> libhkl_solver = SolverClass(geometry="E4CV")
>>> solver
HklSolver(name='hkl_soleil', version='v5.0.0.3434', geometry='E4CV', engine='hkl', mode='bissector')

HklSolver(geometry, *[, engine, mode])

"hkl_soleil" (Linux x86_64 only) Hkl/Soleil.

class hklpy2.backends.hkl_soleil.HklSolver(geometry: str, *, engine: str = 'hkl', mode: str = '', **kwargs)[source]#

Bases: SolverBase

"hkl_soleil" (Linux x86_64 only) Hkl/Soleil.

Wraps the Hkl/Soleil library, written by Frédéric-Emmanuel PICCA (Soleil), with support for many common diffractometer geometries.

Parameters

  • geometry: (str) Name of geometry.

  • engine: (str) Name of computation engine. (default: "hkl")

  • mode: (str) Name of operating mode. (default: current mode)

  • pseudos: ([PseudoPositioner]) List of pseudo positioners. (default: [])

  • reals: ([PositionerBase]) List of real positioners. (default: [])

Note

The lists of pseudos and reals are the corresponding axes of the diffractometer, in the order expected by the Solver geometry. The diffractometer can use names that are different from the names expected by the engine here. The Operator class will convert between the two sets of names.

Python Methods

addReflection(reflection)

Add coordinates of a diffraction condition (a reflection).

calculate_UB(r1, r2)

Calculate the UB (orientation) matrix with two reflections.

forward(pseudos)

Compute list of solutions(reals) from pseudos (hkl -> [angles]).

geometries()

Ordered list of the geometry names.

inverse(reals)

Compute tuple of pseudos from reals (angles -> hkl).

refineLattice(reflections)

Refine the lattice parameters from a list of reflections.

removeAllReflections()

Remove all reflections.

Python Properties

axes_c

HKL real axis names.

axes_r

HKL real axis names (read-only).

axes_w

HKL real axis names.

engine

Selected computational engine for this geometry.

engine_name

Name of selected computational engine for this geometry.

engines

List of the computational engines available in this geometry.

extra_axis_names

Ordered list of any extra parameter names (such as x, y, z).

extras

Ordered dictionary of any extra parameters.

geometry

Name of selected diffractometer geometry.

lattice

Crystal lattice parameters.

mode

Name of the current geometry operating mode.

modes

List of the geometry operating modes.

pseudo_axis_names

Ordered list of the pseudo axis names (such as h, k, l).

real_axis_names

Ordered list of the real axis names (such as th, tth).

sample

Crystalline sample.

UB

Orientation matrix (3x3).

wavelength

Monochromatic wavelength.

property U: list[list[float]]#

Relative orientation of crystal on diffractometer.

Rotation matrix, (3x3).

property UB: list[list[float]]#

Orientation matrix (3x3).

addReflection(reflection: Reflection) None[source]#

Add coordinates of a diffraction condition (a reflection).

property axes_c: list[str]#

HKL real axis names.

Held constant during ‘forward()’ computation.

property axes_r: list[str]#

HKL real axis names (read-only).

property axes_w: list[str]#

HKL real axis names.

Updated by ‘forward()’ computation.

calculate_UB(r1: Reflection, r2: Reflection) list[list[float]][source]#

Calculate the UB (orientation) matrix with two reflections.

The method of Busing & Levy, Acta Cryst 22 (1967) 457.

property engine: gi.repository.Hkl.Engine#

Selected computational engine for this geometry.

property engine_name: str#

Name of selected computational engine for this geometry.

property engines: list[str]#

List of the computational engines available in this geometry.

property extra_axis_names: list[str]#

Ordered list of any extra parameter names (such as x, y, z).

Depends on selected geometry, engine, and mode.

property extras: dict#

Ordered dictionary of any extra parameters.

Depends on selected geometry, engine, and mode.

forward(pseudos: dict) list[dict[str, float]][source]#

Compute list of solutions(reals) from pseudos (hkl -> [angles]).

classmethod geometries() list[str][source]#

Ordered list of the geometry names.

EXAMPLES:

>>> from hklpy2 import get_solver
>>> Solver = get_solver("no_op")
>>> Solver.geometries()
[]
>>> solver = Solver("TH TTH Q")
>>> solver.geometries()
[]
property geometry: str#

Name of selected diffractometer geometry.

Cannot be changed once solver is created. Instead, make a new solver for each geometry.

inverse(reals: dict[str, float]) dict[str, float][source]#

Compute tuple of pseudos from reals (angles -> hkl).

property lattice: gi.repository.Hkl.Lattice#

Crystal lattice parameters. (Not used by this Solver.)

property mode: str#

Name of the current geometry operating mode.

property modes: list[str]#

List of the geometry operating modes.

name = 'hkl_soleil'#

Name of this Solver.

property pseudo_axis_names: list[str]#

Ordered list of the pseudo axis names (such as h, k, l).

property real_axis_names: list[str]#

Ordered list of the real axis names (such as th, tth).

refineLattice(reflections: list[Reflection]) Lattice[source]#

Refine the lattice parameters from a list of reflections.

hkl_soleil uses a simplex method.

removeAllReflections() None[source]#

Remove all reflections.

property sample: gi.repository.Hkl.Sample#

Crystalline sample. libhkl’s sample object.

property wavelength: float#

Monochromatic wavelength.

hklpy2.backends.hkl_soleil._roundoff(values, digits=12)[source]#

Prevent underflows and ‘-0’.

hklpy2.backends.hkl_soleil.hkl_euler_matrix(euler_x, euler_y, euler_z)[source]#

Convert into matrix form.

hklpy2.backends.hkl_soleil.to_hkl(arr)[source]#

Convert a numpy ndarray to an hkl Matrix

Parameters:

arr (ndarray)

Return type:

Hkl.Matrix

hklpy2.backends.hkl_soleil.to_numpy(mat)[source]#

Convert an hkl Matrix to a numpy ndarray

Parameters:

mat (Hkl.Matrix)

Return type:

ndarray