code: def rotate(
      input,
      angle,
      axes=(1, 0),
      reshape=True,
      output=None,
      order=3,
      mode="constant",
      cval=0.0,
      prefilter=True,
  ):
      """
      Rotate an array.
  
      The array is rotated in the plane defined by the two axes given by the
      `axes` parameter using spline interpolation of the requested order.
  
      Parameters
      ----------
      %(input)s
      angle : float
          The rotation angle in degrees.
      axes : tuple of 2 ints, optional
          The two axes that define the plane of rotation. Default is the first
          two axes.
      reshape : bool, optional
          If `reshape` is true, the output shape is adapted so that the input
          array is contained completely in the output. Default is True.
      %(output)s
      order : int, optional
          The order of the spline interpolation, default is 3.
          The order has to be in the range 0-5.
      %(mode)s
      %(cval)s
      %(prefilter)s
  
      Returns
      -------
      rotate : ndarray
          The rotated input.
  
      """
      input = numpy.asarray(input)
      axes = list(axes)
      rank = input.ndim
      if axes[0] < 0:
          axes[0] += rank
      if axes[1] < 0:
          axes[1] += rank
      if axes[0] < 0 or axes[1] < 0 or axes[0] > rank or axes[1] > rank:
          raise RuntimeError("invalid rotation plane specified")
      if axes[0] > axes[1]:
          axes = axes[1], axes[0]
      angle = numpy.pi / 180 * angle
      m11 = math.cos(angle)
      m12 = math.sin(angle)
      m21 = -math.sin(angle)
      m22 = math.cos(angle)
      matrix = numpy.array(
          [[m11, m12], [m21, m22]], dtype=numpy.float64
      )
      iy = input.shape[axes[0]]
      ix = input.shape[axes[1]]
      if reshape:
          mtrx = numpy.array(
              [[m11, -m21], [-m12, m22]], dtype=numpy.float64
          )
          minc = [0, 0]
          maxc = [0, 0]
          coor = numpy.dot(mtrx, [0, ix])
          minc, maxc = _minmax(coor, minc, maxc)
          coor = numpy.dot(mtrx, [iy, 0])
          minc, maxc = _minmax(coor, minc, maxc)
          coor = numpy.dot(mtrx, [iy, ix])
          minc, maxc = _minmax(coor, minc, maxc)
          oy = int(maxc[0] - minc[0] + 0.5)
          ox = int(maxc[1] - minc[1] + 0.5)
      else:
          oy = input.shape[axes[0]]
          ox = input.shape[axes[1]]
      offset = numpy.zeros((2,), dtype=numpy.float64)
      offset[0] = float(oy) / 2.0 - 0.5
      offset[1] = float(ox) / 2.0 - 0.5
      offset = numpy.dot(matrix, offset)
      tmp = numpy.zeros((2,), dtype=numpy.float64)
      tmp[0] = float(iy) / 2.0 - 0.5
      tmp[1] = float(ix) / 2.0 - 0.5
      offset = tmp - offset
      output_shape = list(input.shape)
      output_shape[axes[0]] = oy
      output_shape[axes[1]] = ox
      output_shape = tuple(output_shape)
      output = _ni_support._get_output(
          output, input, shape=output_shape
      )
      if input.ndim <= 2:
          affine_transform(
              input,
              matrix,
              offset,
              output_shape,
              output,
              order,
              mode,
              cval,
              prefilter,
          )
      else:
          coordinates = []
          size = numpy.product(input.shape, axis=0)
          size //= input.shape[axes[0]]
          size //= input.shape[axes[1]]
          for ii in range(input.ndim):
              if ii not in axes:
                  coordinates.append(0)
              else:
                  coordinates.append(slice(None, None, None))
          iter_axes = list(range(input.ndim))
          iter_axes.reverse()
          iter_axes.remove(axes[0])
          iter_axes.remove(axes[1])
          os = (output_shape[axes[0]], output_shape[axes[1]])
          for ii in range(size):
              ia = input[tuple(coordinates)]
              oa = output[tuple(coordinates)]
              affine_transform(
                  ia,
                  matrix,
                  offset,
                  os,
                  oa,
                  order,
                  mode,
                  cval,
                  prefilter,
              )
              for jj in iter_axes:
                  if coordinates[jj] < input.shape[jj] - 1:
                      coordinates[jj] += 1
                      break
                  else:
                      coordinates[jj] = 0
      return output
  
file_path: catboost/contrib/python/scipy/py2/scipy/ndimage/interpolation.py
imports: from __future__ import division, print_function, absolute_import
  import math
  import numpy
  import warnings
  from .None import _ni_support
  from .None import _nd_image
  from ._ni_docstrings import docdict
  from scipy.misc import doccer
label_desc: Use image node_id 9 for calling a global function with example usage: rotate(input, angle, axes, reshape, output, order, mode, cval, prefilter) and returns: output