0

I want to implement a wavelet threshold noise reduction method using the SureShrink method for time series data.

Code

import numpy as np
import pywt

threshold = pywt.threshold_sure(coeffs[i], np.sqrt(2 * np.log(len(data))), 'soft')`

Note: I changed the function name to pywt.threshold_sure. It didn't work.

Issue

However, when I run the demo code, an error is reported:

AttributeError: module 'pywt' has no attribute 'sure_thresh'

How to solve it?

hc_dev
  • 8,389
  • 1
  • 26
  • 38
  • Where did you get the demo code from? From [PyWavelet's docs on Thresholding](https://pywavelets.readthedocs.io/en/latest/ref/thresholding-functions.html#thresholding) it looks like there are only functions `threshold` and `threshold_firm`, but no function named `sure_thresh` (as the AttributeError complains). How did you rename the function to to `threshold_sure` and with which intend? – hc_dev Jun 29 '23 at 05:55
  • Firstly, thank you for the edit, which fully expresses my question. Secondly, as you said in your comment, there is no function named sure_thresh (as the AttributeError complains), which should mean that this demo code is wrong. So where can I get the correct code to implement a wavelet threshold noise reduction method using the SureShrink method for time series data? Besides SureShrink, I am also considering methods like VisuShrink, HeurSure, etc. – chengguan86 Jul 01 '23 at 01:55
  • I'm currently looking into the exact same: I have found this lib: http://rafat.github.io/wavelib/index.html#/ It's exactly what I need but it's written in C-code and not Python...And I don't know how to convert the code. I have even tried with help of multiple AI frameworks. I have also contacted the dev of the lib - but no answer so far :( – PabloDK Jul 01 '23 at 12:07

0 Answers0