transform.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:WaveletQuotes 作者: JobyKK 项目源码 文件源码
def cwt_time(data, wavelet, widths, dt, axis):
    # wavelets can be complex so output is complex
    output = np.zeros((len(widths),) + data.shape, dtype=np.complex)

    # compute in time
    slices = [None for _ in data.shape]
    slices[axis] = slice(None)
    for ind, width in enumerate(widths):
        # number of points needed to capture wavelet
        M = 10 * width / dt
        # times to use, centred at zero
        t = np.arange((-M + 1) / 2., (M + 1) / 2.) * dt
        # sample wavelet and normalise
        norm = (dt / width) ** .5
        wavelet_data = norm * wavelet(t, width)
        output[ind, :] = scipy.signal.fftconvolve(data,
                                                    wavelet_data[slices],
                                                    mode='same')
    return output
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号