omega_solns_core#

anri.diffract.omega_solns_core(q_sample, k_in_sample)[source]#

Solve the Ewald condition for omega, up to the choice of Friedel branch.

Parameters:
  • q_sample (Array) – [3] Scattering vector in sample frame

  • k_in_sample (Array) – [3] Incoming scaled normalised wave-vector in sample frame

Returns:

  • asin_term (jax.Array) – \(\arcsin(\delta / R)\) in radians, clipped to keep the gradient finite

  • phi (jax.Array) – Phase \(\phi = \arctan2(\alpha, \beta)\) in radians

  • valid (jax.Array) – Boolean indicating if a valid solution exists

Notes

The Ewald condition reduces to \(\alpha \cos\omega + \beta \sin\omega = \delta\), which harmonic addition turns into \(R \sin(\omega + \phi) = \delta\) with \(R = \sqrt{\alpha^2 + \beta^2}\). Both Friedel solutions follow from \(\arcsin(\delta / R)\) and \(\phi\); only the final phase shift distinguishes them, so those two quantities are the natural thing to compute once and reuse. See omega_solns() for the full derivation.

Validity is a property of the geometry, not of the branch, so it is returned here rather than per solution.

See also

omega_from_core

Selects one branch from this output.

omega_solns

Returns a single solution in degrees.

omega_solns_both

Returns both solutions in degrees.