• 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

  • 相关阅读:
    JDBC中execute、executeQuery和executeUpdate的区别
    Android开发之线程间通信
    redis面试题收集
    VMware-克隆虚拟机
    java计算机毕业设计家庭食谱管理系统2021MyBatis+系统+LW文档+源码+调试部署
    Python 和 Ruby 谁是最好的Web开发语言?
    SLAM从入门到精通(用c++实现机器人运动控制)
    python学习笔记(12)---(内置模块)
    六面阿里天猫,已拿offer,我的面经复盘总结,原来进大厂没那么难了
    ppt 作图 如何生成eps格式
  • 原文地址:https://blog.csdn.net/KPer_Yang/article/details/127723149