def shift(input, shift, output=None, order=3, mode='constant', cval=0.0, prefilter=True):
 if ((order < 0) or (order > 5)):
  raise RuntimeError('spline order not supported')
 input = numpy.asarray(input)
 if numpy.iscomplexobj(input):
  raise TypeError('Complex type not supported')
 if (input.ndim < 1):
  raise RuntimeError('input and output rank must be > 0')
 mode = _extend_mode_to_code(mode)
 if (prefilter and (order > 1)):
  filtered = spline_filter(input, order, output=numpy.float64)
 else:
  filtered = input
 (output, return_value) = _ni_support._get_output(output, input)
 shift = _ni_support._normalize_sequence(shift, input.ndim)
 shift = [(- ii) for ii in shift]
 shift = numpy.asarray(shift, dtype=numpy.float64)
 if (not shift.flags.contiguous):
  shift = shift.copy()
 _nd_image.zoom_shift(filtered, None, shift, output, order, mode, cval)
 return return_value

def shift ( input , shift , output = None , order = 3 , mode = 'constant' , cval = 0.0 , prefilter = True ) : if ( ( order < 0 ) or ( order > 5 ) ) : raise RuntimeError ( 'spline order not supported' ) input = numpy . asarray ( input ) if numpy . iscomplexobj ( input ) : raise TypeError ( 'Complex type not supported' ) if ( input . ndim < 1 ) : raise RuntimeError ( 'input and output rank must be > 0' ) mode = _extend_mode_to_code ( mode ) if ( prefilter and ( order > 1 ) ) : filtered = spline_filter ( input , order , output = numpy . float64 ) else : filtered = input ( output , return_value ) = _ni_support . _get_output ( output , input ) shift = _ni_support . _normalize_sequence ( shift , input . ndim ) shift = [ ( - ii ) for ii in shift ] shift = numpy . asarray ( shift , dtype = numpy . float64 ) if ( not shift . flags . contiguous ) : shift = shift . copy ( ) _nd_image . zoom_shift ( filtered , None , shift , output , order , mode , cval ) return return_value
shift an image randomly or non-randomly .