-
Notifications
You must be signed in to change notification settings - Fork 43
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
Using the uncertainties module to propagate errors #1916
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good, minor stylistic issues raised
src/sas/sascalc/fit/BumpsFitting.py
Outdated
reference_params = [v for v in varying if str(v.name) in str(constraints[param_name])] | ||
err_exp = str(constraints[param_name]) | ||
# Convert string entries into variable names within the code. | ||
for i in enumerate(reference_params): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks a bit awkward, maybe use something like:
for i, p in enumerate(reference_params):
err_exp = err_exp.replace(p.name, f"reference_params[{i}].value")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested functionality on W10/x64 comparing against release 5.0.4.
Tried single fit (using LM) and 3 dataset simultaneous fit (using DREAM).
Behaviour seems 'normal'. Uncertainties on optimised parameters look sensible. Residuals look sensible. DREAM plots looked sensible. DREAM output in Log Explorer looked sensible and parameter values were correctly assigned to the correct parameters (something that didn't happen in PR1682).
Parameter/uncertainty values matched v5.0.4 to many dp when using LM. Correspondence using DREAM was obviously not as good but still acceptable (IMHO); eg:
In 5.0.4:
scale,True,0.068696,0.00058734,0.0,inf,():
background,True,-0.057794,0.061883,-inf,inf,():
radius,True,23.969,0.10756,0.0,inf,():
thickness,True,9.0774,0.06878,0.0,inf,():
In this branch:
scale,True,0.068957,0.00060114,0.0,inf,():
background,True,-0.058371,0.0679,-inf,inf,():
radius,True,23.915,0.11556,0.0,inf,():
thickness,True,9.0682,0.089137,0.0,inf,():
So I approve this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that some of @rozyczko requests still need to answered? I've also added few questions
@Caddy-Jones as already responded to @rozyczko comments and will look at the latest comments. Iestyn to merge once addressed. |
Renamed M as fitting_module and R as fitting_result
As discussed in issue #1914, the pull request from #1682 lead to fitting error in SasView. This pull request attempts to accomplish the same goal of propagating errors on constrained parameters by using code inspired by #1682, while avoiding the fitting issues that lead to #1914.