How-to Guides#
Step-by-step guides for common tasks. Each guide assumes you have installed the package and are familiar with the concepts.
Understand how basis vectors map physical directions to Cartesian axes, and how to define a custom basis.
Define a diffractometer that is not one of the 10 presets: axis signs, parent chains, roles, modes, and verification.
Set the radiation wavelength or energy on a geometry, and convert between wavelength, energy, d-spacing, and Q.
Specify unit-cell parameters for any crystal system and inspect the resulting B matrix and reciprocal lattice.
Compute the U and UB matrices from one, two, or three orienting reflections.
Find the motor angles that satisfy the Bragg condition for a given reflection (hkl → motor angles).
Choose which stages are free, fixed, or coupled during a forward calculation.
Understand the constraint framework: DOF rule, constraint categories, custom modes, and the extras dict for advanced modes.
Set the surface normal and azimuthal reference vector; compute incidence angle, exit angle, ψ, and naz.
Compute motor-angle sequences along a path through reciprocal space, or for a ψ scan.
Refine unit-cell parameters from measured Bragg peak positions using Busing & Levy (1967) least-squares or the Nelder-Mead simplex method, with and without crystal-system constraints.
Save the complete diffractometer state to JSON or YAML and restore it in a later session.
Account for a diffractometer mounted at a non-zero angle relative to the incident beam.
Benchmark forward/inverse throughput and round-trip accuracy across all geometries and modes.
Full worked example: orient a sapphire crystal on a four-circle diffractometer (APS 7-ID-C session).