code: def vec_to_halfvec(vec):
      
      d = vec[1:] - vec[:-1]
      if ((d/d.mean()).std() > 1e-14) or (d.mean() < 0):
          raise ValueError('vec must be np.arange() in increasing order')
      dx = d.mean()
      lowest = np.abs(vec).min()
      highest = np.abs(vec).max()
      return np.arange(lowest, highest + 0.1*dx, dx).astype(vec.dtype)
docs: Transforms a vector np.arange(-N, M, dx) to np.arange(min(|vec|), max(N,M),dx)]