defsmooth_with_wavelets(y):""" FUNCTION TO SMOOTH SIGNAL VIA WAVELET DECOMPOSITION INPUTS: - y = array-like signal to smooth OUTPUTS: - y_rec = smoothed version of input signal DEPENDENCIES: - PyWavelets 1.3.0 - numpy 1.21.5 CODE AUTHORED BY: SHAWHIN TALEBI """# wavelet decompositioncoeffs=pywt.wavedec(y,'sym5',mode='symmetric')# zero out last 5 detail coefficentsforiinrange(5):coeffs[i+5]=np.zeros(coeffs[i+5].shape)# wavelet recompositiony_rec=pywt.waverec(coeffs,'sym5',mode='symmetric')[1:]returny_rec