code: def dwrap(kx,nc):
      '''compute a wrapped distance'''
      q1 = np.mod(kx, nc)
      q2 = np.minimum(q1, nc-q1)
      return qf dwrap(kx,nc):
      '''compute a wrapped distance'''
      q1 = np.mod(kx, nc)
      q2 = np.minimum(q1, nc-q1)
      return q2
docs: compute a wrapped distance