问题描述
scipy.signal.cwt
的文档 说:
scipy.signal.cwt(data, wavelet, widths)
小波:函数小波函数,它应该有 2 个参数.第一个参数是返回向量的点数将有 (len(wavelet(width,length)) == length).第二个是宽度参数,定义小波的大小(例如标准高斯偏差).查看满足这些条件的 rickerrequirements.wavelet : function 小波函数,需要 2 个参数.
wavelet : function Wavelet function, which should take 2 arguments. The first argument is the number of points that the returned vector will have (len(wavelet(width,length)) == length). The second is a width parameter, defining the size of the wavelet (e.g. standard deviation of a gaussian). See ricker, which satisfies these requirements.wavelet : function Wavelet function, which should take 2 arguments.
除了scipy.signal.ricket
,还有哪些内置小波函数可以传递给scipy.signal.cwt?
Beyond scipy.signal.ricket
, what are the other built-in wavelet functions that I can pass to scipy.signal.cwt?
我在 scipy/scipy/signal/wavelets.py 中看到
__all__ = ['daub', 'qmf', 'cascade', 'morlet', 'ricker', 'cwt']
并查看每个小波函数的参数,只有 ricket
似乎与 scipy.signal.cwt(data, wavelet, widths)
一起使用(因为只有ricker
正好接受 2 个参数).
and looking at the arguments of each of those wavelet functions, only ricket
seems to work with scipy.signal.cwt(data, wavelet, widths)
(as only ricker
takes precisely 2 arguments).
推荐答案
我问了 SciPy 用户列表上的问题,答案 1:
我发现 CWT 的模块很混乱,所以我推出了自己的模块:
https://github.com/Dapid/fast-pycwt
它专为速度而生(我的跑步时间从 4 小时缩短到 20 分钟).没有经过彻底的测试,仅限于单双;但对我来说,它处于足够好"的状态.
It is built for speed (I got my running time from 4 h down to 20 min). It is not thoroughly tested, and it is limited to single and double; but for me it is in a "good enough" state.
答案 2:
您可能还会发现我的版本很有用:
https://github.com/aaren/wavelets
我还发现 scipy 小波令人困惑.我的版本包括一个更快的cwt 可以采用以频率或时间表示的小波.
I also found scipy wavelets confusing. My version includes a faster cwt that can take wavelets expressed in either frequency or time.
我发现使用小波函数更直观时间/频率和宽度作为参数而不是当前方法(我更喜欢在真实空间而不是样本空间中思考).
I found it more intuitive to have wavelet functions that take time/frequency and width as arguments rather than the present method (I prefer thinking in real space rather than sample space).
目前,scipy自带的morlet小波,scipy.signal.wavelets.morlet
,不能用作 cwt 的输入.这我觉得很不幸.
Presently, the morlet wavelet that comes with scipy, scipy.signal.wavelets.morlet
, cannot be used as input to cwt. This is unfortunate I think.
此外,目前的 cwt 不允许复杂的输出.这对 ricker 没有影响,但小波函数很复杂总的来说.
Additionally, the present cwt doesn't allow complex output. This doesn't make a difference for ricker but wavelet functions are complex in general.
我修改后的cwt"方法在这里:
My modified 'cwt' method is here:
https://github.com/aaren/wavelets/blob/master/wavelets.py#L15
它可以接受在时间或频率空间定义的小波函数,使用 fftconvolve,并允许复杂的输出.
It can accept wavelet functions defined in time or frequency space, uses fftconvolve, and allows complex output.
我的背景是基于对 Torrence 和 Compo 的阅读:
My background on this is based on a reading of Torrence and Compo:
Torrence 和 Compo,小波分析实用指南"(BAMS,1998)
Torrence and Compo, 'A Practical Guide to Wavelet Analysis' (BAMS, 1998)
http://paos.colorado.edu/research/wavelets/
希望能帮到你,
阿龙
这篇关于在哪里可以看到可以传递给 scipy.signal.cwt 的内置小波函数列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!