-
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
Implement the decorrelator #163
Conversation
This reverts commit a056728.
Codecov Report
@@ Coverage Diff @@
## master #163 +/- ##
==========================================
+ Coverage 97.72% 97.78% +0.06%
==========================================
Files 20 20
Lines 1097 1128 +31
Branches 230 236 +6
==========================================
+ Hits 1072 1103 +31
Misses 5 5
Partials 20 20
Continue to review full report at Codecov.
|
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.
Can you please explain what the three methods are? Neither the user nor I really knows what the code is supposed to be doing. Once I know what's supposedt o happen, I can review the code in a more meaningful manner.
The other comments are all pretty minor.
Please start a new section in CHANGES for 0.6.0 and add an entry.
Thanks for adding the functionality!
@orbeckst Thank you very much for the review. I have fixed everything else but is struggling with the pytest.fixture
As you can see, the old tests don't use the fixture. Normally, I use fixture or mark.parametrize but I realised now that there might be a problem with using both of them
will not work, where it will complain that the pytest fixture is a function and has no len(). This seems to be a long-standing problem dating back to 2013 pytest-dev/pytest#349 and it seems that one could
I wonder what is your feeling about this? I think abandoning the fixture might be the easiest way out. |
For the fixture, I meant something along the following lines @pytest.fixture
def dataset():
return data.load_ABFE()
@pytest.make.parametrize("value,ref", ...)
def test_something(dataset, value, ref):
... i.e., just not calling data.load_* inside but providing the data as a fixture. I'd think that this won't collide. |
@orbeckst Thanks for the advice.
which uses gmx_benzene_dHdl as a function, and I would need gmx_benzene_dHdl to be a fixture for my test. I wonder what is your advice for transforming this test
|
Perhaps something like @pytest.fixture(scope="class") # class scope only if the data are never modified
def dataset(self):
return gmx_benzene_dHdl()
@pytest.mark.paramtrize("stop,step", [(20, None), (None, -1)])
def test_series(self, dataset, start, stop):
series = dataset[:stop:step]
with pytest.raises(ValueError):
self.slicer(dataset, series=series) The advantage would be that with a class-scoped fixture, |
@orbeckst Thank you very much for the advice, I do understand the advantage of fixtures and it is just that I don't know how to make it work with parameterized. There is another existing test that I'm not sure of how to make it into a fixture.
Where |
I think I would just leave this one. There's a way to parametrize fixtures but it's not cleaner than what you already have for this test. If we don't re-use a fixture and it's not going to be easier to read then leave it, I'd say. DRACO DORMIENS NUMQUAM TITILLANDUS |
@orbeckst Thanks for the advice. I have eventually left the old test untouched and have only applied the fixture to the new tests. |
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.
lgtm, will just add my minor fixes
As is discussed in #159. I have implemented the decorrelators using the logic of the alchemical analysis.