-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Closed
Labels
defectA clear bug or issue that prevents SciPy from being installed or used as expectedA clear bug or issue that prevents SciPy from being installed or used as expectedscipy.ndimage
Milestone
Description
My issue is about the function scipy.ndimage.maximum_filter and its behaviour while using both footprints and a sequence of modes. The current documentation on the site* doesn't mention it, but unless the footprint is seperable scipy silently assumes that the "mode" argument is a string and then raises an error because it isn't.
*link: https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.maximum_filter.html
Reproducing code example:
import numpy as np
from scipy.ndimage.filters import maximum_filter
arr = np.zeros([5, 5])
arr[2, 0] = 1
#use a small diamond - shaped filter
footprint = np.ones([3, 3])
#""" #uncomment this line to make footprint seperable
footprint[0, 0] = 0
footprint[0, 2] = 0
footprint[2, 0] = 0
footprint[2, 0] = 0
#"""
#no sequence - works
filt = maximum_filter(arr,
footprint=footprint,
mode='constant')
#sequence (even one whih should do the same) - doesn't work
filt = maximum_filter(arr,
footprint=footprint,
mode=('constant', 'constant'))
Error message:
Traceback (most recent call last):
File "C:\Users\Sonicrs\Desktop\scipy_bug_tester.py", line 31, in <module>
mode=('constant', 'constant'))
File "C:\Users\Sonicrs\AppData\Local\Programs\Python\Python37\lib\site-packages\scipy\ndimage\filters.py", line 1097, in maximum_filter
cval, origin, 0)
File "C:\Users\Sonicrs\AppData\Local\Programs\Python\Python37\lib\site-packages\scipy\ndimage\filters.py", line 1020, in _min_or_max_filter
mode = _ni_support._extend_mode_to_code(mode)
File "C:\Users\Sonicrs\AppData\Local\Programs\Python\Python37\lib\site-packages\scipy\ndimage\_ni_support.py", line 52, in _extend_mode_to_code
raise RuntimeError('boundary mode not supported')
RuntimeError: boundary mode not supported
Scipy/Numpy/Python version information:
1.2.0 1.15.4 sys.version_info(major=3, minor=7, micro=0, releaselevel='final', serial=0)
Metadata
Metadata
Assignees
Labels
defectA clear bug or issue that prevents SciPy from being installed or used as expectedA clear bug or issue that prevents SciPy from being installed or used as expectedscipy.ndimage