Created
December 23, 2020 11:43
-
-
Save suhaskv/ff1888d5d929841a305ac022acf95623 to your computer and use it in GitHub Desktop.
VSB Power Line Blog - Perform hard-thresholding on the 1st level detail coefficients
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Calculate the sigma value | |
sigma = (1/0.6745) * np.mean(np.absolute(wavlt_coeffs[-1] - np.mean(wavlt_coeffs[-1],None)), None) | |
# Calculate the universal threshold using Stein Unbiased Risk Estimate (SURE) | |
Td = sigma * np.sqrt(2*np.log(len(x))) | |
# Perform hard-thresholding on the 1st level detail coefficient values | |
wavlt_coeffs[1:] = (pywt.threshold(i, value=Td, mode='hard') for i in wavlt_coeffs[1:]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment