-
Notifications
You must be signed in to change notification settings - Fork 17
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
Fixes bar_with_pessimistic_uncertainty convergence error #1344
Conversation
badisa
commented
Jul 16, 2024
•
edited
Loading
edited
- A bug introduced in Resolve inconsistency between bar_with_bootstrapped_uncertainty and df_and_err_from_u_kln #1324
unconverged * A bug introduced in #1324
@@ -180,6 +180,11 @@ def test_df_from_u_kln_does_not_raise_on_incomplete_convergence(): | |||
assert np.isfinite(df) | |||
assert np.isnan(ddf) # returns NaN for uncertainty on incomplete convergence | |||
|
|||
bootstrap_df, bootstrap_ddf = bar_with_pessimistic_uncertainty(u_kln, maximum_iterations=1) |
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 raises an exception without the fix. Didn't launch a CI job as it is an unambigious failure
df, ddf = mbar.getFreeEnergyDifferences() | ||
full_bar_result = df[0, 1] | ||
full_bar_err = ddf[0, 1] | ||
full_bar_result, full_bar_err = df_and_err_from_u_kln(u_kln, maximum_iterations=maximum_iterations) |
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.
df_and_err_from_u_kln handles the behavior correctly: https://github.com/proteneer/timemachine/blob/master/timemachine/fe/bar.py#L136-L139
timemachine/fe/bar.py
Outdated
u_kn, N_k = ukln_to_ukn(u_kln) | ||
mbar = pymbar.MBAR(u_kn, N_k, maximum_iterations=maximum_iterations) |
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.
nit: this seems unnecessary vs. setting initial_f_k=None
below (or maybe better, initial_f_k=np.array([0.0, full_bar_result])
)
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.
Good call, will replace it with initial_f_k=np.array([0.0, df])
which is the same value without constructing an extra MBAR object
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.
Set using pre-existing value in a7de23f
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.
Good catch. Makes sense to reuse df_and_err_from_u_kln
since the latter has the desired workaround.