code: def _calculate_new_overlap(stride, traj_len, skip):
          
          overlap = stride * ((traj_len - skip - 1) // stride + 1) - traj_len + skip
          return overlap
docs: Given two trajectories T_1 and T_2, this function calculates for the first trajectory an overlap, i.e.,
          a skip parameter for T_2 such that the trajectory fragments T_1 and T_2 appear as one under the given stride.
  
          Idea for deriving the formula: It is
  
          K = ((traj_len - skip - 1) // stride + 1) = #(data points in trajectory of length (traj_len - skip)).
  
          Therefore, the first point's position that is not contained in T_1 anymore is given by
  
          pos = skip + s * K.
  
          Thus the needed skip of T_2 such that the same stride parameter makes T_1 and T_2 "look as one" is
  
          overlap = pos - traj_len.
  
          :param stride: the (global) stride parameter
          :param traj_len: length of T_1
          :param skip: skip of T_1
          :return: skip of T_2