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
proposed conversion from u_kln->u_kn formalism #83
Conversation
Do you know why this can't be automatically merged? It seems like your branch is messed up somehow. |
Also, eventually we should probably get all tests running via nose, but we can help you migrate your tests later. |
No idea why it can't be merged automatically. I can try to find a way to commit it some other way as a patch if you want -- it's two clean commits, plus manually adding the master patch which was on top of it. Nose tests can be done after in the polishing if we like what's here. |
Are you basing this on a branch that doesn't include your recently merged pull request? I think that could be the issue. |
Yes. It's a trivial change to do, but perhaps GitHub can't handle. I supposed I should have rebased onto that version first! If you can't think of an easy way, I can try to just create a new branch with the changes. |
Resolving the conflicts will be trivial, I just need to figure out how to do the right resolves . . . |
OK, looks better now. Travis CI will probably fail, I'm guessing (since it wasn't designed to get it right). Might be best to check it out independently and look at it directly for the logic. Not that important to get it perfect, since it's in its own branch. |
Looks like it failed on the imports? I'm not really sure why, that didn't change at all. |
That's the version issue which I will look into independently. |
I guess you've made lots of changes to pymbar.py? It seems like GitHub can't even show the diff because there are so many changes. Does that sound right? |
Yes, mbar.py has a lot of changes. All pretty straightforward, but a lot. Lots of overhaul required to change the entire formalism. |
So I've gone through most of the code (halfway through
|
I've also run the test script on my machine--it seemed to be working OK. |
Possible typo in docstring of computePMF(): "bin_n[n]" (later called "bin_kn") Also in |
OK I made a complete pass through the code and have no additional complaints at this time... |
Commenting one at a time;
Ah, my bad. I was getting carried away with editing and getting tired of writing numpy instead of np. Should I revert that change in the pull request, and then we put it back in in separate commit? |
Fixed (will update the pull request after number of these). |
Done, except for ones that are caused by weave or importing the helper functions (pyflakes doesn't seem to know about the syntax there). |
We seem to be having the |
@mrshirts: @kyleabeauchamp is out for a week, so it's up to us to proceed, I think. Do all the nosetests work on your local version? If so, I wonder if we should merge this and debug the |
Ah, OK. I'll probably get the quick fixes in. The one remaining item is point 5, Expectations vs. General Expectations. Let's have that conversation when Kyle comes back. I'll check the nosetests again. If it passes those, and when everything except point 5 is resolved, yes, I think we should go ahead and merge it in to the kn branch. Maybe hold off merging the branches. |
What is point 5? |
Most importantly, did you fix the undefined variable names? Those are actual bugs which apparently don't have corresponding tests to catch them. |
from Kyle's big comment. I'll file a separate issue on this -- it deserves some thinking. The current state of computeExpectations is not what we want, that's just to demonstrate the potential new approach (And that it can be made equivalent to what we want to do next). Current approach - writing very similar functions 10x |
Yes, those are fixed, mod ones that are actually weird syntax due to C++ imports or weave. |
If the current approach works, then we can work on simplifying the codebase in subsequent PRs. If the current approach is actually "everything is broken", we've got a bit of a problem... |
Current approach works. this is a question of simplifying the codebase (and in parallel, the theory itself). |
Great. Go ahead and merge, and we'll simplify in subsequent PRs. Please make small, individual changes in future! And as soon as you start working on a feature, open a new PR and title it "My new feature [WIP]" to denote work in progress... |
I think in this case, most of it all had to go in together so that the u_kn infrastructure could be supported. I agree smaller changes are usually better. |
Logically grouped changes should occur together, but as Kyle suggested, this shouldn't include things like changing |
Sounds good. Also, the latest pull request reverted the numpy change. |
Thanks! OK, I'll merge this, and we can work out the |
Extensive conversion from u_kln->u_kn formalism. Still need to debug `import version` issues with travis-ci.
includes a slightly modified harmonic_oscillator_update.py, which gives identical behavior with the new code to pymbar-examples/harmonic_oscillator.py run with the previous code up to numerical precision.
This new code automatically converts from old-style u_kln matrices internally.
It supports all existing functionality, including updating the weave code and the _pymbar.c code.
The one major difference is in handling computeExpectations. This change hopefully provides a much more general solution which can possibly reduce the total amount of repetitive code as well.
Previously, computeExpectations recognized whether observables were state_dependent or state_independent by whether the observable array was KxN_max, or KxLxN_max. Now, this is done by giving an explicit state_dependent flag. If state_dependent is False, computeExpectations handles the code like the 2D version before (although now the array is 1D, the observable at each state).
The big difference is if state_dependent is True. In this case, computeExpectations expects K different observables (the K different observables at each state - for example, the potential energies in each of the K states), as well as K different energies (which defaults to just the u_kn matrix MBAR was generated with). It then calculates the expectations of the first observable and the first state, 2nd observable and the 2nd state, and so forth, which is what the previous code did.
In order to make this happen, I've created a computeGeneralExpectations routine, that takes in I observable arrays and K state observables (see see #89 ).
I'm up for lots of other improvements; but I though it would be easier to start by solving the biggest problem first independently of other issues.