rmcgibbo/mdtraj — pull request #30 by rmcgibbo (2013-04-25 22:13:27+00:00)
Title: DCDReader handling EOF without choking

These are a few fixes for dealing with the streaming read. EOF wasn't being handled correctly.

The current code was trying to read the total length of the file on every call to read(), which choked with an, EOF if you'd already read a few frames. I put in an instance variable, `frame_pointer` that stores the number of frames that have been read, so we know our position in the file. Also, if you try to read more frames than are in the file, we need to slice the output arrays to be returned, since we malloced more space than necessary.