Closed rolfjl closed 4 years ago
Yes, you can discard the final, extra coefficient on axis 1 in your example. If I recall correctly, such coefficients are automatically trimmed at intermediate stages of a multilevel reconstruction, but there is no reference signal to know the size unambiguously at the last level and it can be up to 1 element larger than the starting signal. The user currently has to discard this extra sample.
I will close this is something we cannot easily fixed without switching to something like a class-based API where a WaveletTransform object could store the original shape and do the trimming for the user.
This has been a common question in the past, so we should probably add a FAQ or something explaining the issue.
Hi developers,
I have a question regarding waverecn and the output dimension. Do you suggest that I trim the output to get the same dimention as the original signal? Or is this a bug?
import numpy import pywt input_data=numpy.ones((22,155,128)) wdec=pywt.wavedecn(input_data,'db2','symmetric',2) output_data = pywt.waverecn(wdec,'db2','symmetric')
output_data.shape
The code returns: (22, 156, 128)
Best regards Rolf Lorentzen