original_docstring: 
      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 : ndarray
          The input array.
      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 : ndarray or dtype, optional
          The array in which to place the output, or the dtype of the returned
          array.
      order : int, optional
          The order of the spline interpolation, default is 3.
          The order has to be in the range 0-5.
      mode : str, optional
          Points outside the boundaries of the input are filled according
          to the given mode ('constant', 'nearest', 'reflect' or 'wrap').
          Default is 'constant'.
      cval : scalar, optional
          Value used for points outside the boundaries of the input if
          ``mode='constant'``. Default is 0.0
      prefilter : bool, optional
          The parameter prefilter determines if the input is pre-filtered with
          `spline_filter` before interpolation (necessary for spline
          interpolation of order > 1).  If False, it is assumed that the input is
          already filtered. Default is True.
  
      Returns
      -------
      rotate : ndarray or None
          The rotated input. If `output` is given as a parameter, None is
          returned.
  
      
docstring: 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 : ndarray
  The input array.
  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 : ndarray or dtype, optional
  The array in which to place the output, or the dtype of the returned
  array.
  order : int, optional
  The order of the spline interpolation, default is 3.
  The order has to be in the range 0-5.
  
  Returns
  
  rotate : ndarray or None
  The rotated input. If `output` is given as a parameter, None is
  returned.
docstring_tokens: 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 : ndarray The input array . 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 : ndarray or dtype optional The array in which to place the output or the dtype of the returned array . order : int optional The order of the spline interpolation default is 3 . The order has to be in the range 0 - 5 . Returns rotate : ndarray or None The rotated input . If ` output ` is given as a parameter None is returned .
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 : ndarray
          The input array.
      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 : ndarray or dtype, optional
          The array in which to place the output, or the dtype of the returned
          array.
      order : int, optional
          The order of the spline interpolation, default is 3.
          The order has to be in the range 0-5.
      mode : str, optional
          Points outside the boundaries of the input are filled according
          to the given mode ('constant', 'nearest', 'reflect' or 'wrap').
          Default is 'constant'.
      cval : scalar, optional
          Value used for points outside the boundaries of the input if
          ``mode='constant'``. Default is 0.0
      prefilter : bool, optional
          The parameter prefilter determines if the input is pre-filtered with
          `spline_filter` before interpolation (necessary for spline
          interpolation of order > 1).  If False, it is assumed that the input is
          already filtered. Default is True.
  
      Returns
      -------
      rotate : ndarray or None
          The rotated input. If `output` is given as a parameter, None is
          returned.
  
      """
      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, return_value = _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 return_value
code_tokens: def rotate ( input , angle , axes = ( 1 , 0 ) , reshape = True , output = None , order = 3 , mode = 'constant' , cval = 0.0 , prefilter = True ) : 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 , return_value = _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 return_value
short_docstring: Rotate an array.
short_docstring_tokens: Rotate an array .
comment: """
      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 : ndarray
          The input array.
      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 : ndarray or dtype, optional
          The array in which to place the output, or the dtype of the returned
          array.
      order : int, optional
          The order of the spline interpolation, default is 3.
          The order has to be in the range 0-5.
      mode : str, optional
          Points outside the boundaries of the input are filled according
          to the given mode ('constant', 'nearest', 'reflect' or 'wrap').
          Default is 'constant'.
      cval : scalar, optional
          Value used for points outside the boundaries of the input if
          ``mode='constant'``. Default is 0.0
      prefilter : bool, optional
          The parameter prefilter determines if the input is pre-filtered with
          `spline_filter` before interpolation (necessary for spline
          interpolation of order > 1).  If False, it is assumed that the input is
          already filtered. Default is True.
  
      Returns
      -------
      rotate : ndarray or None
          The rotated input. If `output` is given as a parameter, None is
          returned.
  
      """