python - scipy.signal.cwt is getting a value error in correlate() -
i'm getting weird error when attempting use scipy.signal.cwt:
i have list c
, , want take continuous wavelet transform this:
scipy.signal.cwt(np.array(c), scipy.signal.morlet, np.arange(.01,.1,.01))
and weird error:
--------------------------------------------------------------------------- valueerror traceback (most recent call last) <ipython-input-55-5af5e14b96cd> in <module>() ----> 1 sig.cwt(a, sig.morlet, np.arange(.01,.1,.01)) /usr/local/lib/python2.7/site-packages/scipy/signal/wavelets.pyc in cwt(data, wavelet, widths) 359 wavelet_data = wavelet(min(10 * width, len(data)), width) 360 output[ind, :] = convolve(data, wavelet_data, --> 361 mode='same') 362 return output /usr/local/lib/python2.7/site-packages/scipy/signal/signaltools.pyc in convolve(in1, in2, mode) 270 271 if np.iscomplexobj(kernel): --> 272 return correlate(volume, kernel[slice_obj].conj(), mode) 273 else: 274 return correlate(volume, kernel[slice_obj], mode) /usr/local/lib/python2.7/site-packages/scipy/signal/signaltools.pyc in correlate(in1, in2, mode) 129 in1zpadded = np.zeros(ps, in1.dtype) 130 sc = [slice(0, i) in in1.shape] --> 131 in1zpadded[sc] = in1.copy() 132 133 if mode == 'full': valueerror: not broadcast input array shape (66467) shape (66466)
what's causing error?
the third argument of scipy.signal.cwt
widths, must larger 1, change code to:
scipy.signal.cwt(np.array(c), scipy.signal.morlet, np.arange(.01,.1,.01) * len(c))
Comments
Post a Comment