mantidproject / mantid

Main repository for Mantid code
https://www.mantidproject.org
GNU General Public License v3.0
209 stars 122 forks source link

Add correct error calculation to PolarizationEfficienciesWildes #37768

Open rbauststfc opened 1 month ago

rbauststfc commented 1 month ago

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 commented 3 days ago

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 I1^{00}}|^2 * \sigma^2{I_1^{00}} + |\frac{\delta \phi}{\delta I1^{01}}|^2 * \sigma^2{I_1^{01}} + |\frac{\delta \phi}{\delta I1^{10}}|^2 * \sigma^2{I_1^{10}} + |\frac{\delta \phi}{\delta I1^{11}}|^2 * \sigma^2{I_1^{11}}} $$

rbauststfc commented 3 days ago

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 I1^{00}}|^2 * \sigma^2{I_1^{00}} + |\frac{\delta f_p}{\delta I1^{01}}|^2 * \sigma^2{I_1^{01}} + |\frac{\delta f_p}{\delta I1^{10}}|^2 * \sigma^2{I_1^{10}} + |\frac{\delta f_p}{\delta I1^{11}}|^2 * \sigma^2{I_1^{11}}} $$

rbauststfc commented 3 days ago

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 I1^{00}}|^2 * \sigma^2{I_1^{00}} + |\frac{\delta f_a}{\delta I1^{01}}|^2 * \sigma^2{I_1^{01}} + |\frac{\delta f_a}{\delta I1^{10}}|^2 * \sigma^2{I_1^{10}} + |\frac{\delta f_a}{\delta I1^{11}}|^2 * \sigma^2{I_1^{11}}} $$

rbauststfc commented 3 days ago

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 I2^{00}}|^2 * \sigma^2{I_2^{00}} + |\frac{\delta p}{\delta I2^{01}}|^2 * \sigma^2{I_2^{01}} + |\frac{\delta p}{\delta I2^{10}}|^2 * \sigma^2{I_2^{10}} + |\frac{\delta p}{\delta I2^{11}}|^2 * \sigma^2{I_2^{11}} + |\frac{\delta p}{\delta fa}|^2 * \sigma^2{f_a} + |\frac{\delta p}{\delta fp}|^2 * \sigma^2{fp} + |\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 commented 3 days ago

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 commented 3 days ago

TBC

Rho:

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

Error calculation:

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

Alpha:

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

Error calculation:

$$ \huge \sigma_\alpha = \sqrt{|\frac{\delta \alpha}{\delta fa}|^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} $$