def transform(self, traj):
# All needed distances
Dall = mdtraj.compute_distances(traj, self.distance_indexes, periodic=self.periodic)
# Just the minimas
Dmin = np.zeros((traj.n_frames,self.dimension))
res = np.zeros_like(Dmin)
# Compute the min groupwise
for ii, (gi, gf) in enumerate(self.group_identifiers):
Dmin[:, ii] = Dall[:,gi:gf].min(1)
# Do we want binary?
if self.threshold is not None:
I = np.argwhere(Dmin <= self.threshold)
res[I[:, 0], I[:, 1]] = 1.0
else:
res = Dmin
return res
评论列表
文章目录