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
WIP: issue 659: DCD Python 3 #682
Conversation
…es/dcdtimeseries.c
…is and reading in a DCD trajectory in Python 3.5. Can probe the atoms in the trajectory, but can't iterate over the trajectory frames yet.
@tylerjereddy , thanks for taking it on! If there are any modifications that originated with simpletraj, can you please rewrite your history so that the original author appears as the author in the commit (and then add them to AUTHORS). If the commits are not cleanly separable then please still make sure that everyone is properly credited. Once it all works we can rewrite history and compact it. |
|
||
""" | ||
from __future__ import absolute_import, division, print_function, unicode_literals | ||
from __future__ import absolute_import |
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 would be nice if you could keep the imports.
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, many / most of the docstrings got obliterated in the frenzy of trying to 'get it working' as well. I think Alexander had removed some content (including docstrings, Writer object, etc.) he didn't need, so the workflow was something like taking his versions of the dcd python / c modules, then restoring some critical / current MDA code to register the reader and deal with the API changes from the last few months, and then start pasting the DCD Writer and Timeseries objects back in. I suspect there is a smart way to progressively merge in changes from different repos / branches at certain line numbers only, but the extra 'git fu,' at this stage, would probably just detract from my attempts to engineer a solution.
I suspect I'll have to try to get it working first and then there will be some pretty annoying damage control on assigning credit and making sure I don't get credited for just pasting stuff that already existed, etc. Conversely, the disregard for making gradual changes in the workflow could end up making the overall task take longer in the end!
Python 3.5 DCD trajectory iteration appears to have been restored now as well. Still plenty left to do though. |
When loading in a CRD format trajectory, there is clearly an issue placing the coordinates of the first frame over the initial PSF coordinates: u = MDAnalysis.Universe(PSF, CRD) Python 3.5 debug (print statement) output:
Python 2.7 debug (print statement) output:
The same row count is a good sign. Taking a wild guess--the map objects may reflect the fact that Python 3 returns iterators instead of lists in a lot of cases now. |
Ok, unpacking the |
It looks indeed like an array of map generator. The easy solution is to wrap the In the time I took to write this comment, the last commit poped up. And indeed, the map in part of the convoluted construct. |
…2/3 compatibility.
Note that I had to modify |
…coordinate / trajectory writing. Supersedes previous changes to the compiled dcdtimeseries.c
coordinate / trajectory reading. Supersedes previous changes to the compiled dcdtimeseries.c
Ok, it looks like I've re-enabled DCD coordinate / trajectory reading with Cython-level changes in the |
which cython version are you running. It should produce py2/py3 compatible c files. They even promote that feature saying cython is the fastest way to get py2/py3 compatibility. |
I'm using the latest Cython ( |
Note that this is related to the C API itself more than Cython proper, they just happen to be objects used in Cython for our project. See: https://docs.python.org/2/c-api/cobject.html |
…nReader.test_write_dcd
The current challenge is to deal with this: which probably points to the I'm also generally observing some issues at a very basic level with |
The UTF-8 issue seems to pop up when dealing with reading / writing triclinic unit cell data (Issue #187). |
I am working on this issue. Can someone guide me through what is already done and where to start? |
@abhinavgupta94 The discussion above suggests that I managed to get DCD trajectory reading and iteration going (tentatively), but that trajectory writing remained problematic. You could go through the discussion, look at the commits in this PR to see what code I was modifying, and maybe look at what Alexander Rose did in his package (see the original issue)--which I basically modified for MDAnalysis proper. Beyond that, you could simply install MDAnalysis from this branch with Python 3 and try reading / writing DCD files to see what kinds of problems crop up, and then try to squash them systematically. |
@dotsdl Unless someone else has been working on it I don't think there has been any additional progress. I still have some extra information in my lab notes from debugging work on this. Initially someone else was going to take over, but that was probably fuelled by Google Code excitement. I can try to refocus my efforts on this again, but it will be volunteered time and I can't guarantee an expeditious resolution. If another core dev has more free time they are certainly free to take over (nobody is currently assigned). |
@tylerjereddy in the interest of getting MDAnalysis feature-complete for Py3, I can probably take this on this winter (Nov-Dec). Depends on what @orbeckst needs from me, though. |
superseded by #929 |
This is a work in progress branch to get DCD code working with Python 3 #659. The git history will be messy as I am incorporating changes from simpletraj, mixing in my own modifications, and dealing with 0.10 to 0.11 deprecations on both the Python and C API side (simpletraj was modified to use DCD reading only with Python 3 + deprecated MDA syntax--i.e.,
numframes
was causing issues on the C API side).As of my latest commit after executing the following in Python 3.5:
The output obtained (ignoring the built-in MDA python 3 caution message):
It is not currently possible to iterate over a trajectory (and writing is almost certainly not possible yet either), but this is a first step.