scippneutron.conversion.beamline.beam_aligned_unit_vectors#

scippneutron.conversion.beamline.beam_aligned_unit_vectors(incident_beam, gravity)[source]#

Return unit vectors for a coordinate system aligned with the incident beam.

The unit vectors are

e^y=g/|g|zproj=b1(b1e^y)e^ye^z=zproj/|zproj|e^x=e^y×e^z

where b1 is the incident_beam and g is the gravity vector. See the module-level docs of scippneutron.conversion.beamline for details.

Parameters:
  • incident_beam (Variable) – Beam from source to sample. Expects dtype=vector3.

  • gravity (Variable) – Gravity vector. Expects dtype=vector3.

Returns:

BeamAlignedUnitVectors – A dict containing the unit vectors with keys 'ex', 'ey', and 'ez'

Raises:

ValueError – If the incident beam is parallel to gravity. The rotation of the x-z plane is ill-define din this case.

See also

straight_incident_beam

Compute the incident beam for a straight beamline.