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

Add correct error calculation to PolarizationEfficienciesWildes #37768

Open
rbauststfc opened this issue Aug 8, 2024 · 9 comments
Open

Add correct error calculation to PolarizationEfficienciesWildes #37768

rbauststfc opened this issue Aug 8, 2024 · 9 comments
Labels
Awaiting User Response Waiting on input or testing from a third party ISIS Team: LSS Issue and pull requests managed by the LSS subteam at ISIS Reflectometry Issues and pull requests related to reflectometry
Milestone

Comments

@rbauststfc
Copy link
Contributor

The PolarizationEfficienciesWildes algorithm currently uses default Mantid error calculation, which is expected to over-estimate the errors. We need to add bespoke error calculations for the equations being calculated in this algorithm to improve the accuracy. The errors should be calculated using the same approach as we have done for the SANS efficiency algorithms.

This is part of the Polarised Reflectivity epic and a follow-on from issue #35682.

We will need to confirm the error equations to be implemented here. Either the scientists will need to provide these, or we can attempt to derive them using the same approach as we used for SANS and then confirm with our scientists that they are correct before implementing.

@rbauststfc rbauststfc added Reflectometry Issues and pull requests related to reflectometry ISIS Team: LSS Issue and pull requests managed by the LSS subteam at ISIS Awaiting User Response Waiting on input or testing from a third party labels Aug 8, 2024
@rbauststfc rbauststfc moved this from New to Backlog in ISIS LSS Sprint Planning Aug 8, 2024
@rbauststfc
Copy link
Contributor Author

TBC

Phi:

$$ \huge \phi = \frac{(I_1^{00} - I_1^{01})(I_1^{00} - I_1^{10})}{I_1^{00}I_1^{11} - I_1^{01}I_1^{10}} $$

Error calculation:

$$ \huge \sigma_\phi = \sqrt{|\frac{\delta \phi}{\delta I_1^{00}}|^2 * \sigma^2_{I_1^{00}} + |\frac{\delta \phi}{\delta I_1^{01}}|^2 * \sigma^2_{I_1^{01}} + |\frac{\delta \phi}{\delta I_1^{10}}|^2 * \sigma^2_{I_1^{10}} + |\frac{\delta \phi}{\delta I_1^{11}}|^2 * \sigma^2_{I_1^{11}}} $$

@rbauststfc
Copy link
Contributor Author

TBC

Fp:

$$ \huge f_p= \frac{I_1^{00} - I_1^{01} - I_1^{10} + I_1^{11}}{2(I_1^{00} - I_1^{01})} $$

Error calculation:

$$ \huge \sigma_{f_p} = \sqrt{|\frac{\delta f_p}{\delta I_1^{00}}|^2 * \sigma^2_{I_1^{00}} + |\frac{\delta f_p}{\delta I_1^{01}}|^2 * \sigma^2_{I_1^{01}} + |\frac{\delta f_p}{\delta I_1^{10}}|^2 * \sigma^2_{I_1^{10}} + |\frac{\delta f_p}{\delta I_1^{11}}|^2 * \sigma^2_{I_1^{11}}} $$

@rbauststfc
Copy link
Contributor Author

TBC

Fa:

$$ \huge f_a= \frac{I_1^{00} - I_1^{01} - I_1^{10} + I_1^{11}}{2(I_1^{00} - I_1^{10})} $$

Error calculation:

$$ \huge \sigma_{f_a} = \sqrt{|\frac{\delta f_a}{\delta I_1^{00}}|^2 * \sigma^2_{I_1^{00}} + |\frac{\delta f_a}{\delta I_1^{01}}|^2 * \sigma^2_{I_1^{01}} + |\frac{\delta f_a}{\delta I_1^{10}}|^2 * \sigma^2_{I_1^{10}} + |\frac{\delta f_a}{\delta I_1^{11}}|^2 * \sigma^2_{I_1^{11}}} $$

@rbauststfc
Copy link
Contributor Author

TBC

Polarizer efficiency

If calculating from mag workspace:

$$ \huge p= \frac{\phi}{2}\Bigg(\frac{(1-2f_a)I^{00}_2 + (2f_a-1)I^{10}_2 - I^{01}_2 + I^{11}_2}{(1-2f_p)I^{00}_2 + (2f_p-1)I^{01}_2 - I^{10}_2 + I^{11}_2}\Bigg) + \frac{1}{2} $$

Error calculation:

$$ \sigma_p = \sqrt{|\frac{\delta p}{\delta I_2^{00}}|^2 * \sigma^2_{I_2^{00}} + |\frac{\delta p}{\delta I_2^{01}}|^2 * \sigma^2_{I_2^{01}} + |\frac{\delta p}{\delta I_2^{10}}|^2 * \sigma^2_{I_2^{10}} + |\frac{\delta p}{\delta I_2^{11}}|^2 * \sigma^2_{I_2^{11}} + |\frac{\delta p}{\delta f_a}|^2 * \sigma^2_{f_a} + |\frac{\delta p}{\delta f_p}|^2 * \sigma^2_{f_p} + |\frac{\delta p}{\delta \phi}|^2 * \sigma^2_\phi} $$

Otherwise, if calculating from the analyser efficiency:

$$ \huge p= \frac{\phi}{2(2a-1)} + \frac{1}{2} $$

Error calculation:

$$ \huge \sigma_{p} = \sqrt{|\frac{\delta p}{\delta \phi}|^2 * \sigma^2_\phi + |\frac{\delta p}{\delta a}|^2 * \sigma^2_a} $$

@rbauststfc
Copy link
Contributor Author

TBC

Analyser efficiency:

$$ \huge a= \frac{\phi}{2(2p-1)} + \frac{1}{2} $$

Error calculation:

$$ \huge \sigma_{a} = \sqrt{|\frac{\delta a}{\delta \phi}|^2 * \sigma^2_\phi + |\frac{\delta a}{\delta p}|^2 * \sigma^2_p} $$

@rbauststfc
Copy link
Contributor Author

TBC

Rho:

$$ \huge \rho= 2f_p - 1 $$

Error calculation:

$$ \huge \sigma_\rho = \sqrt{|\frac{\delta \rho}{\delta f_p}|^2 * \sigma^2_{f_p}} $$

Alpha:

$$ \huge \alpha= 2f_a - 1 $$

Error calculation:

$$ \huge \sigma_\alpha = \sqrt{|\frac{\delta \alpha}{\delta f_a}|^2 * \sigma^2_{f_a}} $$

Two p minus 1:

$$ \huge tpmo= 2p - 1 $$

Error calculation:

$$ \huge \sigma_{tpmo} = \sqrt{|\frac{\delta tpmo}{\delta p}|^2 * \sigma^2_p} $$

Two a minus 1:

$$ \huge tamo= 2a - 1 $$

Error calculation:

$$ \huge \sigma_{tamo} = \sqrt{|\frac{\delta tamo}{\delta a}|^2 * \sigma^2_a} $$

@acaruana2009
Copy link

Having a very quick look, I think for the $\phi$, $f_p$ and $f_a$ quantities, the assumption that they are made up of independent (uncorrelated) measurements is a fair assumption.

However, I think for the other quantities, because they use derived quantities (i.e. $f_p$, $f_a$ and $\phi$) to calculate them, I am not sure we can say all quantities are independent. It may be we have to substitute in for $f_p$, $f_a$ and $\phi$ so that all calculations are in terms of counts - i.e. in terms of $I^{xx}_{y}$, where $xx$ is the flipper state and $y$ is the type of sample used in the measurement.

Now it may be these give equivalent results for the two ways of calculating (I must admit I need to do more reading on this), but it is worth a check.

@rbauststfc
Copy link
Contributor Author

Thanks for the comments so far @acaruana2009, I get what you're saying about the derived quantities. I'll leave that one with you (definitely beyond my level of knowledge on this!) and just let me know what you find out.

@rbauststfc rbauststfc self-assigned this Nov 18, 2024
@RichardWaiteSTFC
Copy link
Contributor

RichardWaiteSTFC commented Dec 3, 2024

TBC

Polarizer efficiency

If calculating from mag workspace:

p = ϕ 2 ( ( 1 − 2 f a ) I 2 00 + ( 2 f a − 1 ) I 2 10 − I 2 01 + I 2 11 ( 1 − 2 f p ) I 2 00 + ( 2 f p − 1 ) I 2 01 − I 2 10 + I 2 11 ) + 1 2

Error calculation:

σ p = | δ p δ I 2 00 | 2 ∗ σ I 2 00 2 + | δ p δ I 2 01 | 2 ∗ σ I 2 01 2 + | δ p δ I 2 10 | 2 ∗ σ I 2 10 2 + | δ p δ I 2 11 | 2 ∗ σ I 2 11 2 + | δ p δ f a | 2 ∗ σ f a 2 + | δ p δ f p | 2 ∗ σ f p 2 + | δ p δ ϕ | 2 ∗ σ ϕ 2

I think here you need to substitute in the equation for $f_a$ into $p$ then write the error in terms of partial derivatives wrt $I_k^{ij}$ - wolfram alpha may be required!

UPDATE: Sorry I see @acaruana2009 has already commented something similar! I think we can check any error propagation numerically, i.e. generate normally distributed counts $I_k^{ij}$ with a given standard-deviation and determine the standard-deviation of the final results for $p$ etc.

@rbauststfc rbauststfc removed their assignment Jan 7, 2025
@rbauststfc rbauststfc added this to the Release 6.13 milestone Jan 16, 2025
@rbauststfc rbauststfc moved this from Backlog to Icebox in ISIS LSS Sprint Planning Jan 16, 2025
@rbauststfc rbauststfc moved this from Icebox to Backlog in ISIS LSS Sprint Planning Jan 16, 2025
@rbauststfc rbauststfc moved this from Backlog to Icebox in ISIS LSS Sprint Planning Jan 16, 2025
@rbauststfc rbauststfc moved this from Icebox to Backlog in ISIS LSS Sprint Planning Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting User Response Waiting on input or testing from a third party ISIS Team: LSS Issue and pull requests managed by the LSS subteam at ISIS Reflectometry Issues and pull requests related to reflectometry
Projects
Status: Backlog
Status: Gathering Requirements
Development

No branches or pull requests

3 participants