lab_to_sample#

anri.geom.lab_to_sample(v_lab, omega, wedge, chi, dty, y0)[source]#

Convert from lab to sample coordinates (apply the diffractometer stack).

Adapted from ImageD11.transform.compute_g_from_k() and ImageD11.transform.compute_grain_origins(). See Geometry for more details about our geometry.

Parameters:
  • v_lab (Array) – [3] Vector in lab coordinates

  • omega (float) – Omega motor value (degrees)

  • wedge (float) – Wedge motor value (degrees)

  • chi (float) – Chi motor value (degrees)

  • dty (float) – Base diffractometer Y translation value (same units as v_sample)

  • y0 (float) – The true value of dty when the rotation axis (untilted by wedge, chi) intersects the beam

Returns:

v_sample (jax.Array) – [3] Vector in sample coordinates

Notes

Given right-handed rotation matrices \(\matr{W}\), \(\matr{C}\), \(\matr{R}\) for wedge, chi and omega motors respectively, which all follow:

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

Then we get:

\[\vec{v_{\text{sample}}} = \matr{R^T} \cdot \matr{C^T} \cdot \matr{W^T} \cdot \left(\vec{v_{\text{lab}}} - \left(0, \text{dty} - y_0, 0\right)\right)\]