ContinuousWavelets.jl
ContinuousWavelets.jl copied to clipboard
[Bug?] getMeanFreq gives non-monotonous values for some wavelets
Hi,
I've noticed some unexpected behaviour of the function getMeanFreq
, which returns non-monotonous values for some wavelets. I stumbled upon this issue when playing around with the example code of the readme; for some wavelets, the heatmap would not be plotted because it requires increasing y-values, which are given by getMeanFreq
in the example code.
Disclaimer: I have very little knowledge of wavelets and how they function. Perhaps this behaviour is expected or even intended; it does strike me as quite odd, though.
I have not done a thorough test but tried only a few cases. My observations are as such:
- no issues for Morlet, no matter what parameters I gave it
- Battle-Lemarie 4 is problematic for β=1 and large signals but fine for short-ish ones (<10000)
- Haar is problematic even for comparable short signals (~1000)
MWE:
using ContinuousWavelets, Plots
x = 100000 # cBatt4 is fine for x<10000 but cHaar has issues even for ~1000
c1 = wavelet(Morlet(), β=1)
f1 = getMeanFreq(computeWavelets(x, c1)[1])
c2 = wavelet(cBatt4, β=1) # no problem for β=2, but β=1 causes issues for large x
f2 = getMeanFreq(computeWavelets(x, c2)[1])
c3 = wavelet(cHaar)
f3 = getMeanFreq(computeWavelets(x, c3)[1])
plot(f1, yscale=:log10, label="Morlet()", xlabel="i", ylabel="νᵢ", key=:bottomright)
plot!(f2, label="cBatt4")
plot!(f3, label="cHaar")
The resulting plot:
Should this behaviour be intended, please feel free to discard this report. Many thanks for providing this package!