bluesky / hklpy

Diffractometer computation library with ophyd pseudopositioner support
https://blueskyproject.io/hklpy
BSD 3-Clause "New" or "Revised" License
2 stars 11 forks source link

consider xrayutilities as alternative back-end (solver) #162

Open prjemian opened 3 years ago

prjemian commented 3 years ago

It has been suggested (at APS) that the xrayutilities package could be used to support diffractometers as a back-end solver for hklpy. This would add an alternative (#14) to libhkl.

Here's an example from APS 34-ID-C, setting up a 5-circle diffractometer:

from cohere.src_py.beamlines.diffractometer import Diffractometer

class Diffractometer_34idc(Diffractometer):
    """
    Subclass of Diffractometer. Encapsulates "34idc" diffractometer.
    """
    name = "34idc"
    sampleaxes = ('y+', 'z-', 'y+')  # in xrayutilities notation
    detectoraxes = ('y+', 'x-')
    incidentaxis = (0, 0, 1)
    sampleaxes_name = ('th', 'chi', 'phi')  # using the spec mnemonics for scan id.
    detectoraxes_name = ('delta', 'gamma')

    # ...

References

prjemian commented 3 years ago

The geometry configuration (sampleaxes, detectoraxes) is handled by the QConversion() class.

prjemian commented 3 years ago

Pre-defined geometries include:

All are subclass of

which is a subclass of

prjemian commented 3 years ago

Also, there is provision on the code for a kappa axis in the QConversion class, but this does not show up in the published documentation.

As it says in the section head for xrayutilities.experiment:

The strength of the [xrayutilities.experiment] module is the versatile QConversion module which can be configured to describe almost any goniometer geometry.

prjemian commented 3 years ago

Notes (exceprted from previous offline communications):