# Decompose into wavelet components, to the level selected:
ffs = pywt.wavedec(data, 'db8', level=maxlev) # 将信号进行小波分解
zbs = []
plt.figure()
for i in range(1, len(ffs)):
zbs[i] = pywt.threshold(ffs[i], threshold * max(ffs[i])) # 将噪声滤波
datarec = pywt.waverec(zbs, 'db8') # 将信号进行小波重构
Traceback (most recent call last):
maximum level is 5
File "C:/Users/Desktop/1.py", line 59, in
zbs[i] = pywt.threshold(ffs[i], threshold * max(ffs[i])) # 将噪声滤波
TypeError: 'int' object is not callable
你检查下前面的代码是不是把max作为变量名赋值成数值了
用print(type(max)) 看看是不是int类型
max是内置函数,不要作为变量名使用
如有帮助,请点击我的回答下方的【采纳该答案】按钮帮忙采纳下,谢谢!
ffs[i]是int,导致函数pywt.threshold()报错。
可以用help(pywt.threshold) 查看一下函数用法
ffs[i]里面应该放image,而不是int
你确定不是应该处理ffs ,而要处理它的每一个元素吗