Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use scattering angle function from ScippNeutron #54

Closed
jl-wynen opened this issue Jun 24, 2024 · 3 comments · Fixed by #55
Closed

Use scattering angle function from ScippNeutron #54

jl-wynen opened this issue Jun 24, 2024 · 3 comments · Fixed by #55
Assignees

Comments

@jl-wynen
Copy link
Member

Similarly to scipp/esssans#143, use some code in scippneutron.conversion.beamline to compute theta. We can't just use scattering_angles_with_gravity because in reflectometry, we define the scattering angle w.r.t. the sample plane, not the beam direction. Compared to SANS, this means that we ignore the x component in y_prime for two_theta.

@jl-wynen
Copy link
Member Author

I believe I found a bug in the current implementation. We currently define
$$y_d = \frac{g \cdot b_2}{|g|}$$
where $g$ is the gravity vector (pointing down) and $b_2$ is the scattered beam.
see

y = sc.dot(scattered_beam, gravity) / grav

This definition means that the y axis points down. I.e., positive y values are below the incoming beam and negative values above the incoming beam. We then compute the point where the neutron would have been detected without gravity as
$$y'_d = y_d + \frac{|g| m_n^2}{2 h^2} L_2^2 \lambda^2$$
This equation is identical to that in SANS (scattering_angles_with_gravity). However, in SANS, we define (note the minus sign!)
$$y_d = -\frac{g \cdot b_2}{|g|}$$
see https://github.com/scipp/scippneutron/blob/1a1c86a65fb69c727f4c28bef05d8a063e66bb2f/src/scippneutron/conversion/beamline.py#L384

The definition in SANS makes sense. It means that the direction the neutron was scattered in ($y'_d$) is above where it was detected ($y_d$) where 'above' means in negative $g$-direction. But in reflectometry, we get the opposite. The gravity corrected value is below the detected position, i.e., further down along $g$. This is wrong.

This may not have been noticed before because we use an absolute value of $y'_d$ which might mask the effect. But I still think that the result is wrong. The impact on the result is significant:
Figure 1(1)

Has this been compared to Mantid? @jokasimr, @arm61 do you agree with this?

@jl-wynen
Copy link
Member Author

Here is a comparison of IofQ:
Figure 1(2)

@jokasimr
Copy link
Contributor

jokasimr commented Jun 24, 2024

Yes it looks like this could be an issue.

The results have not been compared to mantid. But they have been compared to Jochens program, and there we see a clear discrepance in the form of a shift to lower $Q$. It seems the discrepancy increases with the sample rotation angle is large. See https://scipp.github.io/essreflectometry/user-guide/amor/compare-to-eos.html.

However, the (possible) gravity correction bug here is not enough to explain the discrepancy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants