问题
I need to denoise a signal. I tried to denoise it with savgol_filter but it result in loosing singularities in the signal. In order to denoise and keep singularities i tried to use wavelet transform, wavelet thresholding and inverse wavelet transform but i didn't succeed. Does someone know how to use wavelet denoising ?
here is a text file with signal datas
import numpy as np
from matplotlib import pyplot as plt
from scipy.signal import savgol_filter
import pywt
def readSignal(nomFichier, N):
x=np.zeros((N), dtype=float)
y=np.zeros((N), dtype=float)
fichier=open(nomFichier,"r")
for k in range(N):
l=fichier.readline()
l=l.split(' \t\t\t ',1)
l2=l[1].split(' \n',1)
l[1]=l2[0]
x[k]=float(l[0])
y[k]=float(l[1])
fichier.close()
return x, y
nomFichier='front1.txt'
N=1509
x, y=readSignal(nomFichier, N)
#y=savgol_filter(y, 51, 3)
#cA, cD=pywt.dwt(y, 'db1')
#cA=pywt.thresholding.hard(cA, 400)
#y=pywt.idwt(cA,cD,'db1', 'sp1')
plt.plot(x,y)
plt.show(block=False)
来源:https://stackoverflow.com/questions/33636117/denoising-a-signal-with-pywavelet