Examples#

These notebooks are worked demonstrations — they show hklpy2 working on specific use cases with real (or simulated) hardware configurations. They are not tutorials: they assume you already know the basic workflow. If you are new to hklpy2, start with the Tutorial: Your First Diffractometer first.

The notebooks are available for download from the source code website: https://github.com/bluesky/hklpy2/docs/source/examples.

Getting started#

Example

Description

Example 4-circle diffractometer using creator()

Simulated 4-circle diffractometer built with creator().

Example 4-circle diffractometer custom Python class

Same diffractometer built as a custom Python subclass.

Eulerian geometries (hkl_soleil)#

Example

Description

hkl_soleil E4CH

E4CH (horizontal scattering) 4-circle geometry.

hkl_soleil E4CV

E4CV (vertical scattering) 4-circle geometry.

hkl_soleil E4CV with EPICS motors

E4CV with real EPICS motor PVs.

hkl_soleil E6C psi axis

E6C with the extra psi axis.

hkl_soleil E6C test of calculations

E6C forward/inverse calculation validation.

Kappa geometries (hkl_soleil)#

Example

Description

hkl_soleil K4CV

K4CV kappa 4-circle geometry.

Orientation matrix#

Example

Description

hkl_soleil UB matrix : calculate from 2 reflections.

Calculate the UB matrix from two orientation reflections.

hkl_soleil UB matrix : Set directly

Set the UB matrix directly.

hkl_soleil Refine lattice from 3 reflections

Refine lattice parameters from three or more reflections.

Constraints#

Example

Description

Constraints

Filter forward() solutions by real-axis range; use presets to hold axes fixed during computation.

Advanced topics#

Example

Description

Virtual diffractometer axis

Add a virtual (computed) axis to a diffractometer.

Zone Scan

Scan along a crystallographic zone axis.

Compare hkl_soleil E4CV with SPEC fourc

Cross-validate hklpy2 results against SPEC fourc.

Real instrument examples#

Example

Description

APS ISN Diffractometer

APS ISN 6-circle diffractometer with renamed axes.

NSLS-II tardis diffractometer

NSLS-II TARDIS diffractometer.