-
Notifications
You must be signed in to change notification settings - Fork 664
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
DCD-Cython #1372
DCD-Cython #1372
Conversation
If anyone is interested how to do a rebase with a merge commit.
The author stuff can be fixed with a interactive rebase before this is done. |
81aff85
to
daedcdf
Compare
@kain88-de The test linting failures showed up after you refactored the new |
The print statements in the old dcd test code might be valid complaints though--I'm just referring to the init issues with the new tests. |
You can leave the linting tests as is. I'll fix the corresponding code. |
Argh timeseries won't work |
So that's a good reason to retire the DCD-based correl facility, as in #1373 ? |
Yeah, the removal of timeseries was suggested and agreed upon by all present at the dev meeting yesterday, if I'm not mistaken. Are there DCD-specific tests that fail because timeseries can't be hooked in to the new Cython stuff? |
Checking the logs--looks like mostly core stuff that expects DCD to have timeseries, but actually a very small number of tests involved. |
The time series I'm referring to is the ability to read n frames at once. The correl stuff can go. I also think we should keep reading multiple frames at once. |
self.current_frame += 1 | ||
return DCDFrame(xyz, unitcell) | ||
|
||
def readframes(self, start=None, stop=None, step=None): |
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 have a question about the API here.
- Should we allow to read only a subset of the trajectory with a
atom_indices
argument? - Should we have a
format='fac'
kwarg specifying the layout of the return array?
Keep in mind that this is a low-level function which should also be suitable for a large range of other people while being efficient in runtime and memory 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.
Did we support subset reading before the libdcd rewrite? If not, I'd probably prefer to avoid making any more special features and focus on only supporting what old DCD did, but in Python 3 as well, then when the readers are excised to their own packages they can be perfected as needed.
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.
Yeah we supported subset reading.
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 you said the old & new tests were all passing after the hookup was done? So subset reading was tested elsewhere?
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.
Timeseries didn't pass yet
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 did comment out some of them. Also the memory reader tests use this feature and those tests failed because of missing this feature.
@kain88-de Fair enough, though the message might be a little clearer for the class issue, and I'm not sure there's a huge practical advantage to new style classes here in any case, but might as well use them. Actually, I don't think this would be an issue at all if we were inheriting from the standard library unittest module (as I like to do), but I think you cut that inheritance out when refactoring. Personally, I like to have access to the standard library test functionalities / structuring on top of numpy stuff, but MDA seems to be moving away from that model for whatever reason. |
@kain88-de Is reading multiple frames at once explicitly supported by the C / Cython for DCD? I guess I didn't notice that?! |
No it is not. We had it on our old C code though.
AFAIK old style isn't available in python 3.
There are multiple reasons for the switch away from TestCase inheritance. The biggest is that mixes two testing frameworks and therefore test discovery isn't straight forward anymore or how one should best assert. When I ran your tests locally I also experienced a complete crash of nose after I changed a test. That went away after the refactor. A last reason is our switch to pytests. There you will write more functions and almost no more classes. I know that sounds weird but it actually will make tests easier to read. For example currently you are using inheritance have the same tests run on multiple files. In pytest you would express it like this. @pytest.mark.parametrize('dcdfile, ref', [[DCD, DCD_REF], [DCD_NAMD, DCD_NAMD_REF]])
def test_something(dcdfile, ref):
with DCDFile(dcdfile) as dcd:
# test something Here we are saying with |
I've started using pytest in some projects, but I still like the old Java-inspired framework in the standard lib, and hey Guido also doesn't like pytest. I tend to agree with his view there, but yeah we have to move forward for MDAnalysis. pytest isn't going to replace the numpy testing framework, so in a sense there are still two systems involved, and if you aren't testing an array object, sometimes the plethora of assert statements available in the std lib unittest can be quite powerful. Also, setUp / tearDown is nice and explicit and there's a tendency to avoid heavy decoration of functions with fancy-looking hacks. Re: old-style classes I can't easily tell at glance which of our Travis test suites is running Py 2 vs. 3-- presumably there's a good reason for this. Anyway, it was compatible before the refactor as long you use vanilla nosetests with no plugins, etc. So, the ability to read multiple frames at once has to be coded in to the new C / Cython then, which could be a little bit of effort. |
e439ffd
to
b9dabd2
Compare
b9dabd2
to
b5b749b
Compare
coverage decrease is due TimeseriesCollection not being tested with the new cython code. |
@richardjgowers if you don't like to remove the TimeSeriesCollection #(1375) for the next release how about leaving it in with a |
@kain88-de if we push out 16.2 with some deprecations we can add DCD + Timeseries removal into 17.0, so should be fine? |
At what time do you want to release 16.2? Keep in mind that this PR is essential for python 3. For deprecation announcements I would prefer to announce deprecations only in major releases. They happen less often and give people more time to change their scripts. Not everyone updates their environment constantly. |
@kain88-de Is there anything here I should be working on at the moment? I've added this PR to the Python 2/3 project page. If this PR is getting close to completion, it would probably be helpful to update the Python 2/3 project page to make a sort of 'to do list.' I think there's something from @jbarnoud that we need to address? Maybe it is already up to date until more issues are discovered though. |
We now don't expose the CHARMM bitfield directly anymore in the header. The bitfield is a internal implementation detail of readdcd.h and the wrong value to expose to a user of libdcd. Rather we expose `is_periodic` to enable reading/writing box information. With this change the write/read header test symmetric now.
(Also added pytest-{cov,xdist} which are not absolutely required but very handy.)
8111d71
to
42c7105
Compare
I spent a little bit of time and condensed the history. I still have a copy of the old history in case you want me to restore it. I reduced the originally 179 commits to 100 commits. I diffed old and new history and they are the same (modulo some white space). Locally, all tests related to DCD pass, now waiting for Travis. |
youhou! Congrats guys! |
Awesome. It only took a year to finish this. |
succeeds #1155
Fixes #659
I made a clean rebase on develop here
Changes made in this Pull Request:
PR Checklist