简体   繁体   English

为什么pywt小波变换的输出是一个复杂的数组呢?

[英]Why the output of pywt wavelet transfor is a complex array?

I'm using the python package pywt of python to do continuous wavelet transform for some signals. 我正在使用python的python包pywt对某些信号进行连续小波变换。 As the length of the signals are different, the output coefficient 2d arrays have different number of columns. 由于信号的长度不同,输出系数2d阵列具有不同的列数。 In order to have coefficient arrays with same shape, I emploied the scipy.ndimage.interpolation.zoom to do interpolation. 为了使系数数组具有相同的形状,我使用scipy.ndimage.interpolation.zoom进行插值。 But the inerpolation raised error message as 'Complex type not supported' which means the input array is a complex array. 但是inerpolation将错误消息引发为“不支持复杂类型”,这意味着输入数组是一个复杂的数组。 As we know, actaually the output of pywt cwt is a array/matrix made up of coefficients of the wavelets with different scales and time shifts, and these coefficents should be real number other than complex number. 正如我们所知,pywt cwt的输出是一个由具有不同尺度和时移的小波系数组成的阵列/矩阵,这些系数应该是除复数之外的实数。 So I really don't know how to figure it out. 所以我真的不知道如何解决这个问题。 Could anyone solve this problem or suggest some alternative way to do this interpolation and get same-size out put arrays? 任何人都可以解决这个问题或建议一些替代方法来做这个插值并获得相同大小的输出数组? The simple codes are as what follows 简单的代码如下

import pywt
import scipy
...
[coefficients_return, frequencies] = pywt.cwt(signal, scales, waveletname, dt)
coefficients_interp = scipy.ndimage.interpolation.zoom(input=coefficients_return, zoom= 2., order=3) 
...

TypeError: Complex type not supported

Some wavelets do have complex components, and these are typically chosen when both phase and amplitude are desired. 一些小波确实具有复杂的分量,并且当需要相位和幅度时通常选择这些小波。

Easiest way to solve your problem is to simply chose a different wavelet. 解决问题的最简单方法是简单地选择不同的小波。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM