2

I'm using the code I found here to compute the wavelet transform of a sine wave with a constant frequency.

#!/usr/bin/python2

from pylab import *
import matplotlib.pyplot as plt
import numpy as np
import scipy

x = np.linspace(0, 10, 65536)
y = np.sin(2 * pi * 60 * x)
N = len(y)
Y = np.fft.fft(y)

J = 128
scales = np.asarray([2 ** (i * 0.1) for i in range(J)])

morletft = np.zeros((J, N))
for i in range(J):
    morletft[i][:N/2] = sqrt(2 * pi * scales[i]) * exp(-(scales[i] * 2 * pi * scipy.array(range(N/2)) / N - 2) ** 2 / 2.0)

U = empty((J, N), dtype=complex128)
for i in range(J):
    U[i] = np.fft.ifft(Y * morletft[i])

plt.imshow(abs(U[:,scipy.arange(0,N,1)]), interpolation='none', aspect='auto')
plt.title("Sine Wave")
plt.xlabel("Translation")
plt.ylabel("Scale")
plt.show()

The result looks alright. alright

What I'm really interested in looking at is the phase. I'm extracting phase from the above code using:

imshow(np.unwrap(np.angle(U)), aspect='auto')

and it looks like this:

Why is the phase information present at frequencies higher than (or scales lower than, NOTE: inverted y-axis) that of the signal?

SgrA
  • 155
  • 4

1 Answers1

0

As you can see there is energy also in higher frequencies than your original. This is probably since every level of the wavelet has a band, so the wavelet can show energy at frequencies higher.

The phase exists only as long as there is energy... so it directly connected to it. You can see if the data on the spectrum exists only where there is non zero energy in the spectrum.

Cherny
  • 471
  • 2
  • 6
  • Thank you. I set up a threshold below which the phase information is not processed as described here and most of that stuff goes away. – SgrA Mar 04 '17 at 05:57