code: def odd_ext(x, n, axis=-1):
      """
      Odd extension at the boundaries of an array
  
      Generate a new ndarray by making an odd extension of `x` along an axis.
  
      Parameters
      ----------
      x : ndarray
          The array to be extended.
      n : int
          The number of elements by which to extend `x` at each end of the axis.
      axis : int, optional
          The axis along which to extend `x`.  Default is -1.
  
      Examples
      --------
      >>> from scipy.signal._arraytools import odd_ext
      >>> a = np.array([[1, 2, 3, 4, 5], [0, 1, 4, 9, 16]])
      >>> odd_ext(a, 2)
      array([[-1,  0,  1,  2,  3,  4,  5,  6,  7],
             [-4, -1,  0,  1,  4,  9, 16, 23, 28]])
  
      Odd extension is a "180 degree rotation" at the endpoints of the original
      array:
  
      >>> t = np.linspace(0, 1.5, 100)
      >>> a = 0.9 * np.sin(2 * np.pi * t**2)
      >>> b = odd_ext(a, 40)
      >>> import matplotlib.pyplot as plt
      >>> plt.plot(arange(-40, 140), b, 'b', lw=1, label='odd extension')
      >>> plt.plot(arange(100), a, 'r', lw=2, label='original')
      >>> plt.legend(loc='best')
      >>> plt.show()
      """
      if n < 1:
          return x
      if n > x.shape[axis] - 1:
          raise ValueError(
              (
                  "The extension length n (%d) is too big. "
                  + "It must not exceed x.shape[axis]-1, which is %d."
              )
              % (n, x.shape[axis] - 1)
          )
      left_end = axis_slice(x, start=0, stop=1, axis=axis)
      left_ext = axis_slice(x, start=n, stop=0, step=-1, axis=axis)
      right_end = axis_slice(x, start=-1, axis=axis)
      right_ext = axis_slice(
          x, start=-2, stop=-(n + 2), step=-1, axis=axis
      )
      ext = np.concatenate(
          (2 * left_end - left_ext, x, 2 * right_end - right_ext),
          axis=axis,
      )
      return ext
  
file_path: catboost/contrib/python/scipy/py2/scipy/signal/_arraytools.py
imports: from __future__ import division, print_function, absolute_import
  import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: odd_ext(x, n, axis) and returns: ext, x