rmcgibbo/mdtraj — pull request #243 by rmcgibbo (2014-01-01 09:10:57+00:00)
Title: new top-level iterload method

new function, `md.iterload`.

Loads a trajectory in chunks that are yielded, via an iterator. The idea is that `md.load(x, **kwargs) == reduce(lambda x, y : x.join(y), md.iterload(x, chunk=chunk, **kwargs)` for all `x`, `kwargs`. The current shortfall that I'm aware of is that md.load can accept a list of file names, and takes a discard_overlapping_frames argument, whereas this only takes a single file name. If this is important, it could be added later, but I don't think it's necessary.

This is the analogue of a function named `Trajectory.enum_chunks_from_hdf5`, or something, in msmbuilder2.6, and should ease the transition to the new msmbuilder code base.

Note that for some of the less commonly used trajectory formats, I didn't make the implementation do anything special, it just loads the entire trajectory into memory and then yields chunks. But for the ones that are common (maybe lh5 should be added to that...) I wrote the function to be more memory efficient. But the API is stable whether or not a given format gets the more memory efficient implementation.