scippneutron.conversion.tof.hkl_vec_from_Q_vec#

scippneutron.conversion.tof.hkl_vec_from_Q_vec(*, Q_vec, ub_matrix, sample_rotation)[source]#

Compute hkl indices from momentum transfer.

The hkl indices define the components of the momentum transfer in the sample coordinate system

\[\begin{split}\vec{Q} = \begin{pmatrix} h \\ k \\ l \end{pmatrix}.\end{split}\]

In the lab frame, the momentum transfer as computed by scippneutron.conversion.tof.Q_elements_from_wavelength() is defined as

\[\vec{Q}_l = \vec{k}_i - \vec{k}_f .\]

This quantity is called \(Q\) elsewhere in ScippNeutron.

Those two \(Q\)’s are related by via

\[\vec{Q}_l = 2 \pi R U B \vec{Q},\]

where \(U\) and \(B\) transform from sample space to the lab frame. \(R\) encodes the sample rotation, e.g., as given by a goniometer. See, e.g., Refs. [BL67, dev23, Sav11] for a definition.

This function computes the elements of \(\vec{Q}\), \(h, k, l\) by inverting the above equation.

Parameters:
  • Q_vec (Variable) – Momentum transfer \(\vec{Q}_l\) as a vector variable.

  • ub_matrix (Variable) – Matrix \(\mathsf{UB}\).

  • sample_rotation (Variable) – Sample rotation matrix \(R\).

Returns:

Variable\(h, k, l\) as a vector variable.

See also

scippneutron.conversion.tof.Q_elements_from_wavelength

Computes Q_l.

scippneutron.conversion.tof.Q_vec_from_Q_elements

Packs elements Qx, Qy, Qz into a single vector.

scippneutron.conversion.tof.ub_matrix_from_u_and_b

Compute

math:mathsf{UB} from \(B\) and \(B\) matrices.

scippneutron.conversion.tof.hkl_elements_from_hkl_vec

Unpack the returned hkl vector.