scipp / scippneutron

Neutron scattering toolkit built using scipp for Data Reduction. Not facility or instrument specific.
https://scipp.github.io/scippneutron/
BSD 3-Clause "New" or "Revised" License
4 stars 3 forks source link

Ensure two-theta calculation with gravity works if incoming beam is not perpendicular to gravity #531

Closed SimonHeybrock closed 5 days ago

SimonHeybrock commented 2 months ago

Related to scipp/essreflectometry#14.

jl-wynen commented 2 months ago

This may be easy:

  1. Remove y-component of incoming_beam to define z-axis.
  2. Use gravity to define the y-axis.
  3. Compute angle between incoming_beam and x-z-plane.
  4. Compute theta based on x-y-z-system and subtract above angle.
SimonHeybrock commented 2 months ago

Remove y-component of incoming_beam to define z-axis.

... assuming we never have a beam that is (approx) along y?

jl-wynen commented 2 months ago

Remove y-component of incoming_beam to define z-axis.

... assuming we never have a beam that is (approx) along y?

Yes. We could have a safety check to disallow beams below a certain angle from the y-axis.

Do you think this is an issue in practice? This issue is mostly about reflectometry. Given specular reflection and a beam coming down the y-axis, this would mean that the detector is also position along the y-axis, i.e., in the incoming beam.

SimonHeybrock commented 2 months ago

Do you think this is an issue in practice? This issue is mostly about reflectometry. Given specular reflection and a beam coming down the y-axis, this would mean that the detector is also position along the y-axis, i.e., in the incoming beam.

My thought was that someone might define Z as "up". Adding a simple check (say about the length of the incoming beam after removing Y?) should be sufficient?

jl-wynen commented 2 months ago

Ok. Then you can project the incoming beam onto a plane perpendicular to gravity. Since we only care about the direction, not the length, this should work.