I would like to use scipy.signal.convolve2d()
function from SciPy, but signal
is undefined:
>>> import scipy
...
>>> conv = scipy.signal.convolve2d(data, kernel, mode="same")
Error: Traceback (most recent call last):
File "test.py", line n, in <module>
conv = scipy.signal.convolve2d(data, kernel, mode="same")
AttributeError: module 'scipy' has no attribute 'signal'.
But when I add skimage import:
from skimage.morphology import square
or
from skimage.morphology import disk
It suddenly starts to be defined, and works fine. Any ideas why and how to fix it properly, so it wouldn't need unused import? Skimage is a totally different thing, not related (at least in theory).
Lib versions:
scikit-image 0.19.2 py37hf11a4ad_0 anaconda
scikit-learn 1.0.2 py37hf11a4ad_1
scipy 1.7.3 py37h0a974cb_0
Python version:
Python 3.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)]
Use
to make sure you import the SciPy Signal subpackage.
import skimage
probably importsscipy.signal
under the hood, so the subpackage is available in the namespace; normally, you need to do this yourself.