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

Cylinder absorp corr #532

Merged
merged 84 commits into from
Nov 7, 2024
Merged

Cylinder absorp corr #532

merged 84 commits into from
Nov 7, 2024

Conversation

jokasimr
Copy link
Contributor

@jokasimr jokasimr marked this pull request as ready for review August 2, 2024 12:11
@jokasimr jokasimr requested a review from jl-wynen August 2, 2024 12:13
@jokasimr
Copy link
Contributor Author

jokasimr commented Aug 2, 2024

scipp/essdiffraction#22 will require additional changes in essdiffraction before it can be closed.

The results should be verified with Celine.

But while that's being done this part of the change can be reviewed.

@jokasimr
Copy link
Contributor Author

jokasimr commented Sep 18, 2024

There's now a verification of this through McStas simulation.

Setup

The total counts at a pixel are

$$I(p) = \Omega_{p} \int_{sample} S(x, p) T(x, p) \ dx$$

where $\Omega_p$ is the solid angle of the pixel as seen from the sample, $S$ is the scattering intensity from $x$ in the direction of $p$ and $T$ is the transmission probability through the sample if the neutron scattered at $x$.
If the sample is sufficiently far from the detector, or if we only consider inhomogeneous scattering then $S(x, p)$ is constant and

$$I(p) = \Omega_{p} S(p) \int_{sample} T(x, p) \ dx .$$

The term

$$C_{abs} = \int_{sample} T(x, p) \ dx = \int_{sample} exp(-c (l_1(x) + l_2(x, p))) \ dx$$

is what is computed in the absorption correction procedure, $c$ is the absorption coefficient and $l_1$ and $l_2$ is the distance the neutron traveled through the sample before scattering respectively the distance the neutron traveled through the sample after scattering.

Verifying the absorption correction

The intensity $I(p)$ depends on the absorption coefficient $c$. Taking the ratio of two $I(p)$ computed using different absorption coefficients $c_1$ and $c_2$ we get rid of the solid angle and get the ratio of $C_{abs}$ for the two different absorption coefficients:

$$I_{c_1}(p) / I_{c_2}(p) = C_{c_1, abs} / C_{c_2, abs}$$

$I_{c_1}(p)$ and $I_{c_2}(p)$ can be computed using McStas simulation, $C_{c_1, abs}$ and $C_{c_2, abs}$ are computed from the routine in this repo.

McStas

For one specific setup (cylinder height, radius, $c_1$, $c_2$ etc) this is $I_{c_1}(p) / I_{c_2}(p)$ computed py McStas:
mcstas_5e10_rays

This PR

And this is the corresponding $C_{c_1, abs} / C_{c_2, abs}$:
absorption_correction_medium

Relative Error

The maximum relative error is <2%. But it looks like much of the error is noise from the Monte Carlo simulation. The real error is probably closer to 1%.
relative_error

Comment

The results are close. Strictly speaking this only verifies the relative magnitude of the correction for different pixels, but there is a test that verifies the absolute magnitude in one case at one pixel position.

@jokasimr jokasimr merged commit 29dfbc8 into main Nov 7, 2024
5 checks passed
@jokasimr jokasimr deleted the cylinder-absorp-corr branch November 7, 2024 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Absorption correction for cylindrical samples
3 participants