登录论坛

查看完整版本 : 循环浏览多个字典项以使用小波分析降噪组合


poster
2019-12-03, 09:21
在此先感谢您的帮助。

我正在尝试使用模仿Matlab小波函数的函数分析和绘制Python中小波去噪的所有可能组合。这涉及四个不同的变量,并且在所有变量之间进行迭代。我不确定是否可以附加和循环字典值。有关如何执行此操作的任何建议?下面是我尝试过的。

threshold = {'rigrsure','heursure','sqtwolog','minimaxi'} sorh = {'hard','soft'} scal = {'one', 'sln', 'mln'} for k in pywt.wavelist(kind='discrete'): name = k w = pywt.Wavelet(name) n = pywt.dwt_max_level(len(A), w.dec_len) for l in threshold: thres = l print(thres) for j in sorh: sorh = j print(sorh) for i in scal: scal = i print(scal) A_denoised = wden(A, thr, sorh, scal, n, name) plt.plot(A, color='blue') plt.plot(A_denoised, color='red', label=[name,l,j,i]) plt.legend(loc='upper right') plt.show()

更多&回答... (https://stackoverflow.com/q/59148922)