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. The 
      angle is given in degrees. Points outside the boundaries of the input 
      are filled according to the given mode. If reshape is true, the output 
      shape is adapted so that the input array is contained completely in 
      the output. The parameter prefilter determines if the input is pre-
      filtered before interpolation, if False it is assumed that the input 
      is already filtered.
      
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. The
  angle is given in degrees. Points outside the boundaries of the input
  are filled according to the given mode. If reshape is true, the output
  shape is adapted so that the input array is contained completely in
  the output. The parameter prefilter determines if the input is pre
  filtered before interpolation, if False it is assumed that the input
  is already filtered.
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 . The angle is given in degrees . Points outside the boundaries of the input are filled according to the given mode . If reshape is true the output shape is adapted so that the input array is contained completely in the output . The parameter prefilter determines if the input is pre filtered before interpolation if False it is assumed that the input is already filtered .
code: def rotate(input, angle, axes = (-1, -2), reshape = True,
             output_type = None, 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. The 
      angle is given in degrees. Points outside the boundaries of the input 
      are filled according to the given mode. If reshape is true, the output 
      shape is adapted so that the input array is contained completely in 
      the output. The parameter prefilter determines if the input is pre-
      filtered before interpolation, if False it is assumed that the input 
      is already filtered.
      """
      input = numarray.asarray(input)
      axes = list(axes)
      rank = input.rank
      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 = numarray.pi / 180 * angle
      m11 = math.cos(angle)
      m12 = math.sin(angle)
      m21 = -math.sin(angle)
      m22 = math.cos(angle)
      matrix = numarray.array([[m11, m12],
                               [m21, m22]], type = numarray.Float64)
      iy = input.shape[axes[0]]
      ix = input.shape[axes[1]]
      if reshape:
          mtrx = numarray.array([[ m11, -m21],
                                 [-m12,  m22]], type = numarray.Float64)
          minc = [0, 0]
          maxc = [0, 0]
          coor = numarray.matrixmultiply(mtrx, [0, ix])
          minc, maxc = _minmax(coor, minc, maxc)
          coor = numarray.matrixmultiply(mtrx, [iy, 0])
          minc, maxc = _minmax(coor, minc, maxc)
          coor = numarray.matrixmultiply(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 = numarray.zeros((2,), type = numarray.Float64)
      offset[0] = float(oy) / 2.0 - 0.5
      offset[1] = float(ox) / 2.0 - 0.5
      offset = numarray.matrixmultiply(matrix, offset)
      tmp = numarray.zeros((2,), type = numarray.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,
                                          output_type, shape = output_shape)
      if input.rank <= 2:
          affine_transform(input, matrix, offset, output_shape, None, output, 
                           order, mode, cval, prefilter)
      else:
          coordinates = []
          size = input.nelements() 
          size /= input.shape[axes[0]]
          size /= input.shape[axes[1]]
          for ii in range(input.rank):
              if ii not in axes:
                  coordinates.append(0)
              else:
                  coordinates.append(slice(None, None, None))
          iter_axes = range(input.rank)
          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, None, 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 , - 2 ) , reshape = True , output_type = None , output = None , order = 3 , mode = 'constant' , cval = 0.0 , prefilter = True ) : input = numarray . asarray ( input ) axes = list ( axes ) rank = input . rank 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 = numarray . pi / 180 * angle m11 = math . cos ( angle ) m12 = math . sin ( angle ) m21 = - math . sin ( angle ) m22 = math . cos ( angle ) matrix = numarray . array ( [ [ m11 , m12 ] , [ m21 , m22 ] ] , type = numarray . Float64 ) iy = input . shape [ axes [ 0 ] ] ix = input . shape [ axes [ 1 ] ] if reshape : mtrx = numarray . array ( [ [ m11 , - m21 ] , [ - m12 , m22 ] ] , type = numarray . Float64 ) minc = [ 0 , 0 ] maxc = [ 0 , 0 ] coor = numarray . matrixmultiply ( mtrx , [ 0 , ix ] ) minc , maxc = _minmax ( coor , minc , maxc ) coor = numarray . matrixmultiply ( mtrx , [ iy , 0 ] ) minc , maxc = _minmax ( coor , minc , maxc ) coor = numarray . matrixmultiply ( 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 = numarray . zeros ( ( 2 , ) , type = numarray . Float64 ) offset [ 0 ] = float ( oy ) / 2.0 - 0.5 offset [ 1 ] = float ( ox ) / 2.0 - 0.5 offset = numarray . matrixmultiply ( matrix , offset ) tmp = numarray . zeros ( ( 2 , ) , type = numarray . 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 , output_type , shape = output_shape ) if input . rank <= 2 : affine_transform ( input , matrix , offset , output_shape , None , output , order , mode , cval , prefilter ) else : coordinates = [ ] size = input . nelements ( ) size /= input . shape [ axes [ 0 ] ] size /= input . shape [ axes [ 1 ] ] for ii in range ( input . rank ) : if ii not in axes : coordinates . append ( 0 ) else : coordinates . append ( slice ( None , None , None ) ) iter_axes = range ( input . rank ) 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 , None , 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. The 
      angle is given in degrees. Points outside the boundaries of the input 
      are filled according to the given mode. If reshape is true, the output 
      shape is adapted so that the input array is contained completely in 
      the output. The parameter prefilter determines if the input is pre-
      filtered before interpolation, if False it is assumed that the input 
      is already filtered.
      """