code: def transform(self, traj):
          
          # if there are no features selected, return given trajectory
          if not self.active_features:
              self.add_selection(np.arange(self.topology.n_atoms))
              warnings.warn("You have not selected any features. Returning plain coordinates.")
  
          # otherwise build feature vector.
          feature_vec = []
  
          # TODO: consider parallel evaluation computation here, this effort is
          # only worth it, if computation time dominates memory transfers
          for f in self.active_features:
              # perform sanity checks for custom feature input
              if isinstance(f, CustomFeature):
                  # NOTE: casting=safe raises in numpy>=1.9
                  vec = f.transform(traj).astype(np.float32, casting='safe')
                  if vec.shape[0] == 0:
                      vec = np.empty((0, f.dimension))
  
                  if not isinstance(vec, np.ndarray):
                      raise ValueError('Your custom feature %s did not return'
                                       ' a numpy.ndarray!' % str(f.describe()))
                  if not vec.ndim == 2:
                      raise ValueError('Your custom feature %s did not return'
                                       ' a 2d array. Shape was %s'
                                       % (str(f.describe()),
                                          str(vec.shape)))
                  if not vec.shape[0] == traj.xyz.shape[0]:
                      raise ValueError('Your custom feature %s did not return'
                                       ' as many frames as it received!'
                                       'Input was %i, output was %i'
                                       % (str(f.describe()),
                                          traj.xyz.shape[0],
                                          vec.shape[0]))
              else:
                  vec = f.transform(traj).astype(np.float32)
              feature_vec.append(vec)
  
          if len(feature_vec) > 1:
              res = np.hstack(feature_vec)
          else:
              res = feature_vec[0]
  
          return res
docs: Maps an mdtraj Trajectory object to the selected output features
  
          Parameters
          ----------
          traj : mdtraj Trajectory
              Trajectory object used as an input
  
          Returns
          -------
          out : ndarray((T, n), dtype=float32)
              Output features: For each of T time steps in the given trajectory,
              a vector with all n output features selected.