如何安装EMD-signal
pip install emd-signal
如果想下载快一点可以借助清华源
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple emd-signal
安装测试
运行下面代码块,来源EMD官网
from PyEMD import EMD
import numpy as np
import pylab as plt
# Define signal
t = np.linspace(0, 1, 200)
s = np.cos(11*2*np.pi*t*t) + 6*t*t
# Execute EMD on signal
IMF = EMD().emd(s,t)
N = IMF.shape[0]+1
# Plot results
plt.subplot(N,1,1)
plt.plot(t, s, 'r')
plt.title("Input signal: $S(t)=cos(22\pi t^2) + 6t^2$")
plt.xlabel("Time [s]")
for n, imf in enumerate(IMF):
plt.subplot(N,1,n+2)
plt.plot(t, imf, 'g')
plt.title("IMF "+str(n+1))
plt.xlabel("Time [s]")
plt.tight_layout()
plt.savefig('simple_example')
plt.show()
运行结果

提示TypeError,这时你会毫不犹豫打开网页搜索该错误,不出意外的话你会看到如下链接:
Expected maxsize to be an integeror None\报错如何解决
应该是毫无用处,于是开始反复卸载并安装emd signal,甚至去GitHub中下载安装包,安装怀揣着一丝希望!!!
好吧!我就是这种

错误原因
当我看到TypeError: Expected maxsize to be an integer or None #1016
好了明白了是安装版本不对,自己的环境python = 3.7,而你按照pip install安装是最高版本EMD-signal = 1.6.4,应该python = 3.8满足要求。
这也是我看到下面一篇文章将错就错得到的结果:
PyEMD、EMD、EEMD安装包的一些坑,一文中emd signal=1.2.3
这时只需要简单执行一句:
pip install EMD-signal == 1.2.3
问题就解决了
运行结果

629

被折叠的 条评论
为什么被折叠?



