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

Using the uncertainties module to propagate errors #1916

Merged
merged 4 commits into from
Oct 13, 2021
Merged

Conversation

Caddy-Jones
Copy link
Contributor

@Caddy-Jones Caddy-Jones commented Sep 22, 2021

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.

@wpotrzebowski wpotrzebowski added Discuss At The Call Issues to be discussed at the fortnightly call and removed Discuss At The Call Issues to be discussed at the fortnightly call labels Sep 27, 2021
Copy link
Member

@rozyczko rozyczko left a 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

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):
Copy link
Member

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")

Copy link
Contributor

@smk78 smk78 left a 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.

@butlerpd butlerpd added the Discuss At The Call Issues to be discussed at the fortnightly call label Oct 12, 2021
Copy link
Contributor

@wpotrzebowski wpotrzebowski left a 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

@butlerpd
Copy link
Member

@Caddy-Jones as already responded to @rozyczko comments and will look at the latest comments. Iestyn to merge once addressed.

@wpotrzebowski wpotrzebowski removed the Discuss At The Call Issues to be discussed at the fortnightly call label Oct 12, 2021
Renamed M as fitting_module and R as fitting_result
@Caddy-Jones Caddy-Jones merged commit 7a6cf9e into main Oct 13, 2021
@krzywon krzywon deleted the uncertainties_2.0 branch August 18, 2022 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants