You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I run the following code to visualize some wavelets with specific wavelengths. However when I increase my wavelength some samples will spike towards 0. This gets increasingly worse with longer wavelengths. I would greatly appreciate your solution or insight
import pywt
import numpy as np
import math
import matplotlib.pyplot as plt
def generate_wavelet(wavelet_name, n_points, wavelength):
# Scale computation
scale = pywt.frequency2scale(wavelet_name, 1/wavelength, precision=math.log2(n_points))
# Signal (impulse to visualize wavelet)
signal = np.zeros(n_points)
signal[n_points//2] = 1
# Perform Continuous Wavelet Transform
coeffs, _ = pywt.cwt(signal, scales=[scale], wavelet=wavelet_name)
return coeffs[0]
wavelengths = [20, 40, 80, 100]
n = len(wavelengths)
plt.figure(figsize=(20,5))
for i, wavelength in enumerate(wavelengths):
wavelet = generate_wavelet('morl', 5*wavelength, wavelength)
plt.subplot(1, n, i+1)
plt.title("wavelength: " + str(wavelength))
plt.plot(wavelet)
The text was updated successfully, but these errors were encountered:
I run the following code to visualize some wavelets with specific wavelengths. However when I increase my wavelength some samples will spike towards 0. This gets increasingly worse with longer wavelengths. I would greatly appreciate your solution or insight
The text was updated successfully, but these errors were encountered: