Tutorials#

This page contains tutorials on how to use Anri.

Crystallography#

Anri’s crystallography is a set of plain functions. Dan’s Diffraction reads the CIF; Anri gets the lattice parameters and space group from it, computes the B matrix, lists the reflections, groups them into rings (by d-star) and computes structure factors.

Geometry#

Goniometer#

Anri currently uses the FABLE geometry definitions for converting to and from detector, laboratory and sample coordinate systems. Please see the included FABLE geometry document for their definitions.

As that document isn’t perfectly descriptive, I’ll try to describe slightly more what convention we use. We use a right-handed coordinate system. With no goniometer rotations (all angles zero), the \(\omega\) rotation axis (vertical) defines our \(Z\) direction. The dty stage defines the \(Y\) axis, and the \(X\) axis (approximately down-beam) is perpendicular to \(Y\) and \(Z\). If you are the beam, looking towards the detector from the source, the \(Y\) axis points to the left.

Our goniometer stack is as follows:

sample
omega - roll around Z axis
chi - roll around X axis
wedge - roll around Y axis (in ImageD11 this has a negative sign, we definine it as positive.)
dty stage - horizontal translation. Defines Y axis.
Hutch floor

General rotation functions like anri.geom.rot_z() work thusly. Imagine the most basic stage, with a single rotation about \(Z\). We want to generate a rotation matrix that encodes the pose of the stage. When we receive the matrix \(\matr{R_z}\), it is applied like this:

\[\matr{R_z} \cdot \vec{v_{\text{sample}}} = \vec{v_{\text{lab}}}\]

Detector#

Anri currently uses the FABLE geometry definitions for detector space.

Forward Modeling#

There’s a very basic demonstration of how to perform a forward model with Anri, a walk through the renderer that simulates whole scanning 3DXRD datasets, and a DCT scan rendered with it (a stored run: it needs a GPU, so it is not re-executed when the docs are built).

Indexing#

Indexing finds each voxel’s orientations from the data alone, by fitting every voxel’s orientation occupancies jointly with the forward model. The first notebook makes a phantom microstructure (grains, misoriented cells and twins), the second simulates a scan of it and indexes it from scratch. The third runs the steps of python -m anri.index one at a time on any ImageD11 dataset (or the phantom), with a diagnostic plot and, where it is cheap, a slider for each option, and prints the command line with the values chosen. They are not re-executed when the docs are built.