Closed EstebanHess closed 5 years ago
Sorry about not getting back to you about this sooner.
I think there may be corner cases where setting coefficients to None can cause problems. The recommended solution is to use arrays of zeros equal in size and dtype to the original coefficients that you want to omit.
Truncating the end of the reconstructed signal as you have done in your notebook should be correct. The extra coefficients at the end are left over from the boundary extensions (mode='smooth' in your case) and can be safely discarded.
I think the one case that never produces any excess coefficients is mode='periodization'
for signals with size that is an integer multiple of 2**level
.
Currently, I am able to decompose a signal using discrete wavelet transform and to reconstruct a signal while leaving out higher frequencies (I found the code on your github page). You can find the code that I have implemented here: https://github.com/EstebanHess/WaveletTransform_with_pywt/blob/master/Extract_High_Freqs.ipynb
My question is: How do I reconstruct a signal while leaving out lower frequencies? Or, in other words: How do I extract only the higher frequency components from a signal?
I managed to obtain the higher frequency components by first reconstructing a lower frequency component and then subtracting the latter from the original signal. This is problematic, however, since the lower frequency reconstructions are longer than the original signal and need to be sliced. By using simple example data (two different sine waves), it is possible to know how to slice the reconstructed signal by visual inspection. But how would I do this with real data?