Luc Pingo
Luc Pingo

Reputation: 23

Morlet wavelet in scipy.cwt function

I am using continuous wavelet transform with scipy.

In the doc the signal.ricker function is used for the wavelet:

https://docs.scipy.org/doc/scipy-0.16.0/reference/generated/scipy.signal.cwt.html

The code works with the signal.ricker function which uses the mexican hat wavelet:

from scipy import signal
import matplotlib.pyplot as plt
import numpy as np
import pywt


sig  = data
widths = np.arange(1, 31)

cw = signal.cwt(sig, signal.ricker, widths)

Now I want to use instead of signal.ricker and mexican hat wavelet the morlet wavelet.

So far I have tried those morlet functions without any success:

morl1 = signal.morlet(125, w=5.0, s=1.0, complete=True)

and:

wavelet = pywt.ContinuousWavelet('morl')
zA, zD = wavelet.wavefun(level=8)
morl2 = zA

Is there any method so the morlet wavelet can be used for the continuous wavelet transform with scipy?

cw = signal.cwt(sig, morlet, widths)

Upvotes: 0

Views: 3627

Answers (1)

SaraR
SaraR

Reputation: 11

The original signal.morlet is not appropriate for using with the signal.cwt-function.

You can use scipy.signal.morlet2 instead, which creates a complex morlet wavelet made specially for signal.cwt.

Upvotes: 1

Related Questions