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

[defects] Bad fitting result at high q range in finding the adjustment factor b in incoherent scattering #24

Open
glass-ships opened this issue Dec 17, 2024 · 1 comment

Comments

@glass-ships
Copy link
Member

Problem Description:

In order to find the adjustment factor , b, for the inelastic incoherent level. The algorithm minimizes this cost function : SUM ( [I(q,lambda_ref) – I(q, lambda)]^2 ) over full q-ranges that all I(q,lambda) share. However, if you have very strong coherent scatterer like silica below

image

The algorithm over-subtract the background (b) and the cost function is still minimized (b varies from 0 to about 6, while I_max exceeds 1000 ) due to large weighting posed by the low-q/high-intensity data. As a result, I(q, lambda) at high q values q> 0.02 in the above example becomes negative, but still makes the cost function to be minimized.

Steps to Reproduce:

The above results can be provide from the scripts as follows.
The test json files can be found at /SNS/EQSANS/shared/codereview/test_ccd/20220407_inelfail/output/*.json

There are three test cases.

  • nocorrection : this one did not use the inelastic correction.
  • _inel : this one used inelastic correction with the selectminincoh = True
  • _inel_nomin : this one used inelastic correction but without selecting minincoh.

Results are summarized here:

image

As one can see for the _inel or _inel_nomin, they oversubtracted ‘b’ (as in I’ = I – b) and ended up having negative I’ for some higher q-values where I(q, lambda) < b(lambda). We believe that this happens because the low-q intensity (very strong intensity) dominates the minimization algorithm. Instead, we should focus on the high-q where generally incoherent scattering dominates.

Investigation/Analysis Results:

Proposed solution is as follows:

The adjustment factor, b, can be calculated from the equations:

image

  1. Implementing this 1/I weighting to estimate b as described in the above writing. (The weighting is unique for each q value. In the above hand-written equation 1/Iqref is q dependent)
  2. For the new error estimation of b, let’s try the uncertainty package for python to avoid long derivation. Then, the error estimation of I’ which is I-b will be straight forward.
  3. Keep the old method somewhere so that we can go back if things doesn’t work. An option in json may not be necessary. An extra parameters in the function call should be enough.
@glass-ships
Copy link
Member Author

This issue was migrated from code.ornl.gov.

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

No branches or pull requests

1 participant