Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discrepancy between CWT in ContinuousWavelets, Matlab and R #56

Open
ManuelFossa opened this issue Jun 14, 2024 · 1 comment
Open

Discrepancy between CWT in ContinuousWavelets, Matlab and R #56

ManuelFossa opened this issue Jun 14, 2024 · 1 comment

Comments

@ManuelFossa
Copy link

Hi,

I ran a CWT using ContinuousWavelets, Matlab WTC package (Grinstead), and R's Biwavelet package, on the same signal.
The result are consistent between R and matlab, but not at all with ContinuousWavelets. Can you help me?

signal = Matrix{Float64}(DataFrame(CSV.File("data.csv")))

       signal = Matrix{Float64}(DataFrame(CSV.File("data.csv")))

signal = vec(signal)



        c = ContinuousWavelets.CWT(Morlet());

        res = ContinuousWavelets.cwt(signal, c)

        Plots.heatmap(abs.(res)', xlabel= "time index",
        ylabel="frequency index",colorbar=false)

data.csv
Screenshot from 2024-06-14 12-25-12

@dsweber2
Copy link
Member

At a guess, it looks like both of those packages have far more detailed defaults for even such a short signal (it looks to only have 46 entries?). You will need to increase the number of wavelets significantly to get a similar detail to those plots. s gives the # of wavelets per octave, and β gives the tail off towards 0 frequency. In general ContinuousWavelets is aimed at supporting significantly longer signals than this.

c = wavelet(morl, s=32, β = 1, averagingLength=-1)

res = ContinuousWavelets.cwt(signal, c)
heatmap(abs.(res)', xlabel= "time index", ylabel="frequency index",colorbar=false)

Here's something that more or less closer to the general plot that they have.

Here's the docs regarding wavelet spacing, and the genera docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants