scipy连续小波变换
scipy連續小波變換
連續小波變換,使用小波函數對數據執行連續小波變換。CWT使用由寬度參數和長度參數表征的小波函數執行與數據的卷積。允許小波函數是復數形式。接口:
scipy.signal.cwt(data, wavelet, widths, dtype=None, **kwargs)
“”"
Continuous wavelet transform.
Performs a continuous wavelet transform on data, using the wavelet function. A CWT performs a convolution with data using the wavelet function, which is characterized by a width parameter and length parameter. The wavelet function is allowed to be complex.
Parameters
data(N,) ndarray
data on which to perform the transform.
waveletfunction
Wavelet function, which should take 2 arguments. The first argument is the number of points that the returned vector will have (len(wavelet(length,width)) == 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.
(小波函數,它應該帶2個參數。第一個參數是返回的向量將具有的點數(len(小波(長度,寬度))==length)。第二個是寬度參數,定義了小波的大小(例如高斯的標準差)。參見ricker,它滿足了這些要求。)
widths(M,) sequence
Widths to use for transform.
dtype:data-type, optional
The desired data type of output. Defaults to float64 if the output of wavelet is real and complex128 if it is complex.
所需的輸出數據類型。如果小波的輸出為實值,則默認為float64,如果它是復數的,則復數128。
kwargs
Keyword arguments passed to wavelet function.
Returns
cwt: (M, N) ndarray
Will have shape of (len(widths), len(data)).
對于非對稱復值小波,輸入信號與小波數據的時反復共軛卷積[1].
“”"
代碼
from scipy import signal
import matplotlib.pyplot as plt
import numpy as np
t = np.linspace(-1, 1, 200, endpoint=False)
sig = np.cos(2 * np.pi * 7 * t) + signal.gausspulse(t - 0.4, fc=2)
widths = np.arange(1, 31)
cwtmatr = signal.cwt(sig, signal.ricker, widths)
plt.imshow(cwtmatr, extent=[-1, 1, 31, 1], cmap=‘PRGn’, aspect=‘auto’,
vmax=abs(cwtmatr).max(), vmin=-abs(cwtmatr).max())
plt.show()
引用
[^1] : S. Mallat, “A Wavelet Tour of Signal Processing (3rd Edition)”, Academic Press, 2009.
et Tour of Signal Processing (3rd Edition)”, Academic Press, 2009.
[^2] : scipy.signal.cwt — SciPy v1.9.3 Manual
總結
以上是生活随笔為你收集整理的scipy连续小波变换的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 使用JAVA工具类进行邮件发送
- 下一篇: ZBRUSH4圆雕浮设计视频教程3dma