scippneutron.conversion.beamline.two_theta#

scippneutron.conversion.beamline.two_theta(*, incident_beam, scattered_beam)[source]#

Compute the scattering angle between scattered and transmitted beams.

See beamline for the definition of the angle.

The result is equivalent to

\[\begin{split}b_1 &= \mathtt{incident\_beam} / |\mathtt{incident\_beam}| \\ b_2 &= \mathtt{scattered\_beam} / |\mathtt{scattered\_beam}| \\ 2\theta &= \mathsf{acos}(b_1 \cdot b_2)\end{split}\]

but uses a numerically more stable implementation by W. Kahan described in paragraph of [Kah00]. See also https://people.eecs.berkeley.edu/~wkahan/MathH110/Cross.pdf.

Parameters:
Returns:

Variable | DataArray | Dataset | DataGroup[Any]\(2\theta\)

See also

straight_incident_beam

Compute the incident beam for a straight beamline.

straight_scattered_beam

Compute the scattered beam for a straight beamline.

scattering_angles_with_gravity

Calculate two_theta and phi with gravity.