[Scipy-svn] r3453 - trunk/scipy/ndimage

scipy-svn@scip... scipy-svn@scip...
Mon Oct 22 07:10:28 CDT 2007


Author: stefan
Date: 2007-10-22 07:10:00 -0500 (Mon, 22 Oct 2007)
New Revision: 3453

Modified:
   trunk/scipy/ndimage/_ni_support.py
   trunk/scipy/ndimage/interpolation.py
Log:
Fix zooming.


Modified: trunk/scipy/ndimage/_ni_support.py
===================================================================
--- trunk/scipy/ndimage/_ni_support.py	2007-10-22 01:18:47 UTC (rev 3452)
+++ trunk/scipy/ndimage/_ni_support.py	2007-10-22 12:10:00 UTC (rev 3453)
@@ -65,7 +65,7 @@
 import warnings
 def _get_output(output, input, output_type = None, shape = None):
     if output_type != None:
-        msg = "'output_type' argument is decrepated."
+        msg = "'output_type' argument is deprecated."
         msg += " Assign type to 'output' instead."
         raise RuntimeError, msg
         warnings.warn(msg, DeprecationWarning)

Modified: trunk/scipy/ndimage/interpolation.py
===================================================================
--- trunk/scipy/ndimage/interpolation.py	2007-10-22 01:18:47 UTC (rev 3452)
+++ trunk/scipy/ndimage/interpolation.py	2007-10-22 12:10:00 UTC (rev 3453)
@@ -37,9 +37,6 @@
 
 def _extend_mode_to_code(mode):
     mode = _ni_support._extend_mode_to_code(mode)
-    if mode == 2:
-        warnings.warn('Mode "reflect" may yield incorrect results on '
-                      'boundaries. Please use "mirror" instead.')
     return mode
 
 def spline_filter1d(input, order = 3, axis = -1, output = numpy.float64,
@@ -324,12 +321,11 @@
         filtered = input
     zoom = _ni_support._normalize_sequence(zoom, input.ndim)
     output_shape = [int(ii * jj) for ii, jj in zip(input.shape, zoom)]
-    zoom = [1.0 / ii for ii in zoom]
+    zoom = (numpy.array(input.shape)-1)/(numpy.array(output_shape,float)-1)
     output, return_value = _ni_support._get_output(output, input,
                                         output_type, shape = output_shape)
     zoom = numpy.asarray(zoom, dtype = numpy.float64)
-    if not zoom.flags.contiguous:
-        zoom = shift.copy()
+    zoom = numpy.ascontiguousarray(zoom)
     _nd_image.zoom_shift(filtered, zoom, None, output, order, mode, cval)
     return return_value
 



More information about the Scipy-svn mailing list