I got confused by the widths parameter, which is passed to scipy.signal.cwt() and by extension to scipy.signal.find_peaks_cwt() . A previous and very useful question about stack overflow (and pointers in it) explained most of my confusion. widths is an array of scales with which you can stretch a wavelet to convolution with your data.
What confused me is - what are the units of widths elements ? Does width 1 mean that the wavelet is stretched to be one βindexβ wide, where index is the distance between the data elements? At first I assumed that it was, but (a) the width can take non-integer values, and (b) the results of cwt () can vary depending on the width.
Here is some code that illustrates my confusion. Why do the last two lines give different results?
The results are close, but the second call finds one spurious peak in the input element 63. Thus, I am not sure if the units of width are the indices of the data vector. But what else can they be? If not, what are the units of widths ? cwt() and find_peaks_cwt() never know or do not see any units of the x axis (for example, the support vector, which I define in my code), so what am I missing? When, in practice, does it make sense to use a non-integer width?
source share