[SciPy-Dev] ndimage reflect mode

Matthew Brett matthew.brett at gmail.com
Fri Oct 31 03:16:38 EDT 2014


Hi,

Sorry if this is a dumb question, but I just noticed some behavior of
scipy.ndimage that surprised me:

In [63]: oned = np.arange(1, 10, dtype=float)
In [64]: scipy.ndimage.affine_transform(oned, [1], [-2], mode='reflect')
Out[64]: array([ 2.,  1.,  1.,  2.,  3.,  4.,  5.,  6.,  7.])

OK so far.  But this I was surprised by:

In [68]: scipy.ndimage.affine_transform(oned, [1], [-2 - 1e-15], mode='reflect')
Out[68]: array([ 2.,  1.,  2.,  2.,  3.,  4.,  5.,  6.,  7.])

Why did the third value turn from a 1 into a 2?  I am missing something obvious?

Matthew



More information about the SciPy-Dev mailing list