def test_pos(self): r = DataInMemory(self.d) r.chunksize = 17 it = r.iterator() t = 0 for itraj, X in it: assert t == it.pos t += len(X) if it.last_chunk_in_traj: t = 0
def estimate(self, X, chunksize=None, **kwargs): # ensure the input is able to provide a stream if not isinstance(X, Iterable): from pyemma.util import types array_list = types.ensure_traj_list(X) X = DataInMemory(array_list, chunksize=chunksize) # Because we want to use pipelining methods like get_output, we have to set a data producer. self.data_producer = X X.chunksize = chunksize # run estimation try: super(StreamingEstimator, self).estimate(X, **kwargs) except NotConvergedWarning as ncw: self.logger.info("Presumably finished estimation. Message: %s" % ncw) return self