Skip to content

Conversation

@tylerjereddy
Copy link
Member

@tylerjereddy tylerjereddy commented Oct 21, 2016

Reference: #929

PR for testing various features of the Cython DCD file handling implementation in the above branch. It currently does not closely follow the libmdaxdr testing suite as I wanted to just get it going with the test module format I'm familiar with.

One of the current test failures is related to reading unit cell dimensions and @kain88-de has already indicated that this is a design feature -- it will be engineered in later for more flexibility.

It might be nice if I could check the current frame after a seek -- this is the only other issue at the moment: AttributeError: 'MDAnalysis.lib.formats.libdcd.DCDFile' object has no attribute 'current_frame'. I'm probably just not supposed to access that, but how can I conveniently pull out the currently registered frame number otherwise?

@kain88-de
Copy link
Member

I'm probably just not supposed to access that, but how can I conveniently pull out the currently registered frame number otherwise?

I added a tell method to return the current frame. The xdr-wrapper handles it the same.

# confirm shape of coordinate data against result from previous
# MDAnalysis implementation of DCD file handling
dcd_frame = self.dcdfile.read()
xyz = dcd_frame[0]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dcd_frame is a namedtuple. You can access the coordinates also with dcd_frame.x

@kain88-de
Copy link
Member

@tylerjereddy thanks for working on this.

@tylerjereddy
Copy link
Member Author

Thanks, all tests except for the unit cell dimensions are passing now. Of course, more tests will be needed.

@tylerjereddy
Copy link
Member Author

I've added several more unit tests based on the xdr stuff. Most things pass, except that:

  • test_read_write_mode_file raises an IOError instead of RuntimeError as the xdr tests expect.
  • test_open_wrong_mode also raises an IOError instead of ValueError as the xdr tests expect.

I'm not sure that either of those are really that important, but just so you know.

@kain88-de
Copy link
Member

Hm. I think the libmdaxdr API is wrong. It would be better if the XDRFile classes (and derived classes) only raise IOError like libdcd is doing now. You can change them to IOError. I'll make a change of the libmdaxdr API to raise IOError exclusively.

…_read_write_mode_file and test_open_wrong_mode.
@tylerjereddy
Copy link
Member Author

Done, thanks.

@kain88-de kain88-de merged commit 78a4257 into dcd-cython Oct 24, 2016
@kain88-de
Copy link
Member

Thanks

@tylerjereddy tylerjereddy deleted the dcd-test-read-frames branch October 26, 2016 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants