-
Notifications
You must be signed in to change notification settings - Fork 51
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
Allow dF-state to be plotted #112
Conversation
Codecov Report
@@ Coverage Diff @@
## master #112 +/- ##
==========================================
- Coverage 97.56% 97.33% -0.23%
==========================================
Files 15 16 +1
Lines 822 939 +117
Branches 167 205 +38
==========================================
+ Hits 802 914 +112
Misses 5 5
- Partials 15 20 +5
Continue to review full report at Codecov.
|
@orbeckst Thank you for the review. I'm a bit confused as to the yellow lines in the code coverage (https://codecov.io/gh/alchemistry/alchemlyb/pull/112/diff?src=pr&el=tree#diff-c3JjL2FsY2hlbWx5Yi92aXN1YWxpc2F0aW9uL2RGX3N0YXRlLnB5) as in the debug mode I have checked to makes sure that these lines are indeed executed in the test. |
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.
I thought I had submitted this review earlier but GitHub told me that it was still pending so I am submitting it now. Sorry if this sounds confusing to you but it sounded to me that you already had seen a review from me.
Please see comments inline to make the code a bit clearer. Thanks!
docs/visualisation.rst
Outdated
-------------------------------------------- | ||
Another way of assessing the quality of free energy estimate would be comparing | ||
the free energy difference between adjacent lambda states (dF) using different | ||
estimators. The function :func:`~alchemlyb.visualisation.plot_dF_state` can |
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.
reference Klimovich paper
estimators. The function :func:`~alchemlyb.visualisation.plot_dF_state` can | |
estimators [Klimovich2015]_. The function :func:`~alchemlyb.visualisation.plot_dF_state` can |
docs/visualisation.rst
Outdated
|
||
Will give a plot looks like this | ||
|
||
.. image:: images/dF_states.png |
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.
You can also use the .. figure::
directive, which also allows you put down a caption https://docutils.sourceforge.io/docs/ref/rst/directives.html#figure
======================================= | ||
|
||
The function :func:`~alchemlyb.visualisation.plot_dF_state` allows the user to | ||
plot and compare the dF from various kinds of :class:`~alchemlyb.estimators`. |
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.
Write out "dF" as free energy difference between states ("dF") to make the text self contained.
docs/visualisation.rst
Outdated
>>> mbar_coul = MBAR().fit(u_nk_coul) | ||
>>> mbar_vdw = MBAR().fit(u_nk_vdw) | ||
|
||
>>> dhdl_data = [(ti_coul, ti_vdw), |
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's not really dH/dl, is it? I find the variable name misleading. Maybe just call it estimators
?
plot and compare the dF from various kinds of :class:`~alchemlyb.estimators`. | ||
|
||
To compare the dF states of a single alchemical transformation among various | ||
:class:`~alchemlyb.estimators`, the user can pass a list of `dhdl_data`. (e.g. |
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.
Instead of dhdl_data
just call it estimators
.
Also, in reST, normally code is marked up with double back-quotes. Single backquotes are the "default role".
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.
@orbeckst Thank you for the review. I was hoping to show a list with reference to different estimators instead of a line of code.
estimators = [:class:`~alchemlyb.estimators.TI`, :class:`~alchemlyb.estimators.BAR`, :class:`~alchemlyb.estimators.MBAR`]
I would imagine that doing this would not allow the user to click TI to show the page of alchemlyb.estimators.TI
:class:`~alchemlyb.estimators.BAR`), (:class:`~alchemlyb.estimators.MBAR`, | ||
:class:`~alchemlyb.estimators.MBAR`)]) | ||
|
||
The figure could be plotted in `portrait` or `landscape` mode by setting the |
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.
Markup: strings should just be simple text with quotation marks or emphasize. Code uses double back tics. We have in the past used the default role (single back tics) for kwarg names. So
*portrait* or *landscape*
`orientation`
`nb`
the estimators differently. The unit in the y axis could be labelled to other | ||
units by setting `units`, which by default is kcal/mol. | ||
|
||
Please check :ref:`How to plot dF states <plot_dF_states>` for usage. |
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.
Please check :ref:`How to plot dF states <plot_dF_states>` for usage. | |
Please check :ref:`How to plot dF states <plot_dF_states>` for a complete example. |
else: # pragma: no cover | ||
pass |
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.
Just delete
else: # pragma: no cover | ||
pass |
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.
Just delete
else: # pragma: no cover | ||
pass |
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.
just delete
I don't know why coverage thinks that the elif statements are not fully executed, given that the code blocks themselves are shown green. I wouldn't worry about it. Btw, there are some |
@orbeckst Thank you for the insight. I initially thought that the reason that elif is yellow is because of the lack of the else statement and add the else: pass, which didn't seems to help. |
FYI @dotsdl @davidlmobley – I changed the repo settings to allow administrators to override the required checks so that we can still merge even if the coverage patch diff is below threshold. In the case here, coverage indicates that 3 |
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.
@xiki-tempula I forgot: please add an entry to CHANGES (and mention issue #73 in the message; also add #73 after the last where you added plotting
Enhancements
- Allow the overlap matrix of the MBAR estimator to be plotted. (issue #73, PR #107)
- Allow the dhdl of the TI estimator to be plotted. (issue #73, PR #110)
- Allow dF-state to be plotted (issue #73, PR #112)
@orbeckst I'm sorry for the omission, changelog updated. |
Thank you @xiki-tempula ! |
I have ported the dF_state from the alchemical analysis.
I have modified the x axis a bit to make it looks more comfortable.
#73