original_docstring: Apply an affine transformation.
  
      The given matrix and offset are used to find for each point in the 
      output the corresponding coordinates in the input by an affine 
      transformation. The value of the input at those coordinates is 
      determined by spline interpolation of the requested order. Points 
      outside the boundaries of the input are filled according to the given 
      mode. The output shape can optionally be given. If not given it is 
      equal to the input shape. The parameter prefilter determines if the 
      input is pre-filtered before interpolation, if False it is assumed 
      that the input is already filtered.
  
      The matrix must be two-dimensional or can also be given as a
      one-dimensional sequence or array. In the latter case, it is
      assumed that the matrix is diagonal. A more efficient algorithms
      is then applied that exploits the separability of the problem.
      
docstring: Apply an affine transformation.
  The given matrix and offset are used to find for each point in the
  output the corresponding coordinates in the input by an affine
  transformation. The value of the input at those coordinates is
  determined by spline interpolation of the requested order. Points
  outside the boundaries of the input are filled according to the given
  mode. The output shape can optionally be given. If not given it is
  equal to the input shape. The parameter prefilter determines if the
  input is pre-filtered before interpolation, if False it is assumed
  that the input is already filtered.
  
  The matrix must be two-dimensional or can also be given as a
  one-dimensional sequence or array. In the latter case, it is
  assumed that the matrix is diagonal. A more efficient algorithms
  is then applied that exploits the separability of the problem.
docstring_tokens: Apply an affine transformation . The given matrix and offset are used to find for each point in the output the corresponding coordinates in the input by an affine transformation . The value of the input at those coordinates is determined by spline interpolation of the requested order . Points outside the boundaries of the input are filled according to the given mode . The output shape can optionally be given . If not given it is equal to the input shape . The parameter prefilter determines if the input is pre - filtered before interpolation if False it is assumed that the input is already filtered . The matrix must be two - dimensional or can also be given as a one - dimensional sequence or array . In the latter case it is assumed that the matrix is diagonal . A more efficient algorithms is then applied that exploits the separability of the problem .
code: def affine_transform(input, matrix, offset = 0.0, output_shape = None,
                       output_type = None, output = None, order = 3,
                       mode = 'constant', cval = 0.0, prefilter = True):
      """Apply an affine transformation.
  
      The given matrix and offset are used to find for each point in the 
      output the corresponding coordinates in the input by an affine 
      transformation. The value of the input at those coordinates is 
      determined by spline interpolation of the requested order. Points 
      outside the boundaries of the input are filled according to the given 
      mode. The output shape can optionally be given. If not given it is 
      equal to the input shape. The parameter prefilter determines if the 
      input is pre-filtered before interpolation, if False it is assumed 
      that the input is already filtered.
  
      The matrix must be two-dimensional or can also be given as a
      one-dimensional sequence or array. In the latter case, it is
      assumed that the matrix is diagonal. A more efficient algorithms
      is then applied that exploits the separability of the problem.
      """
      if order < 0 or order > 5:
          raise RuntimeError, 'spline order not supported'
      input = numarray.asarray(input)
      if isinstance(input.type(), numarray.ComplexType):
          raise TypeError, 'Complex type not supported'
      if output_shape == None:
          output_shape = input.shape
      if input.rank < 1 or len(output_shape) < 1:
          raise RuntimeError, 'input and output rank must be > 0'
      mode = _ni_support._extend_mode_to_code(mode)
      if prefilter and order > 1:
          filtered = spline_filter(input, order, output = numarray.Float64)
      else:
          filtered = input
      output, return_value = _ni_support._get_output(output, input,
                                          output_type, shape = output_shape)
      matrix = numarray.asarray(matrix, type = numarray.Float64)
      if matrix.rank not in [1, 2] or matrix.shape[0] < 1:
          raise RuntimeError, 'no proper affine matrix provided'
      if matrix.shape[0] != input.rank:
          raise RuntimeError, 'affine matrix has wrong number of rows'
      if matrix.rank == 2 and matrix.shape[1] != output.rank:
          raise RuntimeError, 'affine matrix has wrong number of columns'
      if not matrix.iscontiguous():
          matrix = matrix.copy()
      offset = _ni_support._normalize_sequence(offset, input.rank)
      offset = numarray.asarray(offset, type = numarray.Float64)
      if offset.rank != 1 or offset.shape[0] < 1:
          raise RuntimeError, 'no proper offset provided'
      if not offset.iscontiguous():
          offset = offset.copy()
      if matrix.rank == 1:
          _nd_image.zoom_shift(filtered, matrix, offset, output, order,
                               mode, cval)
      else:
          _nd_image.geometric_transform(filtered, None, None, matrix, offset,
                              output, order, mode, cval, None, None)
      return return_value
code_tokens: def affine_transform ( input , matrix , offset = 0.0 , output_shape = None , output_type = None , output = None , order = 3 , mode = 'constant' , cval = 0.0 , prefilter = True ) : if order < 0 or order > 5 : raise RuntimeError , 'spline order not supported' input = numarray . asarray ( input ) if isinstance ( input . type ( ) , numarray . ComplexType ) : raise TypeError , 'Complex type not supported' if output_shape == None : output_shape = input . shape if input . rank < 1 or len ( output_shape ) < 1 : raise RuntimeError , 'input and output rank must be > 0' mode = _ni_support . _extend_mode_to_code ( mode ) if prefilter and order > 1 : filtered = spline_filter ( input , order , output = numarray . Float64 ) else : filtered = input output , return_value = _ni_support . _get_output ( output , input , output_type , shape = output_shape ) matrix = numarray . asarray ( matrix , type = numarray . Float64 ) if matrix . rank not in [ 1 , 2 ] or matrix . shape [ 0 ] < 1 : raise RuntimeError , 'no proper affine matrix provided' if matrix . shape [ 0 ] != input . rank : raise RuntimeError , 'affine matrix has wrong number of rows' if matrix . rank == 2 and matrix . shape [ 1 ] != output . rank : raise RuntimeError , 'affine matrix has wrong number of columns' if not matrix . iscontiguous ( ) : matrix = matrix . copy ( ) offset = _ni_support . _normalize_sequence ( offset , input . rank ) offset = numarray . asarray ( offset , type = numarray . Float64 ) if offset . rank != 1 or offset . shape [ 0 ] < 1 : raise RuntimeError , 'no proper offset provided' if not offset . iscontiguous ( ) : offset = offset . copy ( ) if matrix . rank == 1 : _nd_image . zoom_shift ( filtered , matrix , offset , output , order , mode , cval ) else : _nd_image . geometric_transform ( filtered , None , None , matrix , offset , output , order , mode , cval , None , None ) return return_value
short_docstring: Apply an affine transformation.
short_docstring_tokens: Apply an affine transformation .
comment: """Apply an affine transformation.
  
      The given matrix and offset are used to find for each point in the 
      output the corresponding coordinates in the input by an affine 
      transformation. The value of the input at those coordinates is 
      determined by spline interpolation of the requested order. Points 
      outside the boundaries of the input are filled according to the given 
      mode. The output shape can optionally be given. If not given it is 
      equal to the input shape. The parameter prefilter determines if the 
      input is pre-filtered before interpolation, if False it is assumed 
      that the input is already filtered.
  
      The matrix must be two-dimensional or can also be given as a
      one-dimensional sequence or array. In the latter case, it is
      assumed that the matrix is diagonal. A more efficient algorithms
      is then applied that exploits the separability of the problem.
      """