示例#1
0
def _efficient_traj_join(trajs):
    assert trajs

    n_frames = sum(t.n_frames for t in trajs)
    concat_traj = preallocate_empty_trajectory(trajs[0].top, n_frames)

    start = 0
    for traj in trajs:
        concat_traj = copy_traj_attributes(concat_traj, traj, start)
        start += traj.n_frames
    return concat_traj
示例#2
0
    def _allocate_chunk(self, expected_length, ndim):
        if (hasattr(self._reader_it._data_source, '_return_traj_obj')
                and self._reader_it._data_source._return_traj_obj):
            X = preallocate_empty_trajectory(
                n_frames=expected_length,
                top=self._reader_it._data_source.featurizer.topology)
        else:
            X = np.empty((expected_length, ndim),
                         dtype=self._frag_reader.output_type())

        return X
示例#3
0
    def _allocate_chunk(self, expected_length, ndim):
        from pyemma.coordinates.data.feature_reader import FeatureReader
        if all(
                isinstance(r, FeatureReader) and r._return_traj_obj
                for r in self._readers):
            X = preallocate_empty_trajectory(
                n_frames=expected_length,
                top=self._readers[0].featurizer.topology)
        else:
            X = np.empty((expected_length, ndim),
                         dtype=self._frag_reader.output_type())

        return X