feat: add func for filtering wavelet soft using pywt

This commit is contained in:
Skudalen 2021-06-24 14:12:21 +02:00
parent 360a0a28a3
commit 6a490cad6c

View File

@ -4,7 +4,7 @@ from pandas.core.frame import DataFrame
from scipy.fft import fft, fftfreq from scipy.fft import fft, fftfreq
import pywt import pywt
from scipy.signal import wavelets from scipy.signal import wavelets
from pyyawt import theselect import pyyawt
import Handle_emg_data as Handler import Handle_emg_data as Handler
@ -129,9 +129,13 @@ def denoise_signal_pywt(df:DataFrame):
print(x) print(x)
return x, cA, cD return x, cA, cD
# # Filters signal accordning to Stein's Unbiased Risk Estimate(SURE)
def threshold_filter(cA, cD): def sure_threshold_filter(cA, cD):
cA_filtered = theselect(cA, 'rigrsure') cA_filtered = pyyawt.theselect(cA, 'rigrsure')
return cA_filtered, cD
def soft_threshold_filter(cA, cD):
cA_filtered = pywt.threshold(cA, 0.9)
return cA_filtered, cD return cA_filtered, cD
# Plots DataFrame objects # Plots DataFrame objects